home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / DISK / DCOMDOC.ARJ / MACRO.DOC < prev   
Text File  |  1991-12-13  |  426KB  |  9,063 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.                                         dCOMdCOM
  15.  
  16.                                  Macro ProgrammingMacro Programming
  17.  
  18.                                       MenuingMenuing
  19.  
  20.                                    Access ControlAccess Control
  21.  
  22.  
  23.  
  24.  
  25.  
  26.                                Shareware Version 4.0
  27.  
  28.  
  29.                         Copyright (c) 1991, Dave Frailey and
  30.                                  DAC Micro Systems
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.        Information in  this document  is subject  to change  without  notice.
  38.        Neither the  owner or  distributors  make  any  expressed  or  implied
  39.        warranties with  regard to  this software,  including merchantability,
  40.        applicability  for   any  purpose   or  non-infringement  of  patents,
  41.        copyrights or  other proprietary  rights of  others.  This software is
  42.        provided "as is" without warranty of any kind.
  43.  
  44.        In no  event will  the owner  or distributors be liable to you for any
  45.        damages, including  any lost profits, lost savings or other incidental
  46.        or consequential  damages arising  out of  the use or inability to use
  47.        this software.
  48.  
  49.        dCOM is not, nor has it ever been, public domain or free software.  It
  50.        is distributed  in two  forms:   1) under  the User Supported software
  51.        concept (Shareware)  or,   2) in  pre-paid form  complete with typeset
  52.        documentation, quick  reference cards,  and user  registration.   Non-
  53.        registered users of dCOM are granted a limited license to use dCOM for
  54.        a trial  period not  to exceed  30 days,  in order  to determine if it
  55.        suits their  needs.   Any other  use of  dCOM or use past this period,
  56.        requires registration.   All  users are  granted a  limited license to
  57.        copy dCOM  only for  the purpose of allowing others to try it, subject
  58.        to the  above restrictions  as  well  as  these:    1)  dCOM  must  be
  59.        distributed in  absolutely  unmodified  form,  including  ALL  program
  60.        files, documentation files, and other files.  dCOM may not be included
  61.        with any  other product  for any  reason whatsoever  without a license
  62.        from DAC  Micro Systems.   No  charge or  payment  may  be  levied  or
  63.        accepted for  dCOM (except  that recovered  for  media  and  operating
  64.        costs).
  65.  
  66.        Bulletin Board  system operators  may  post  dCOM  on  their  BBS  for
  67.        downloading by  their users  without written  permission only  if  the
  68.        above conditions  are met,  and only if no special fee is necessary to
  69.        access the dCOM files (a general fee to access the BBS is acceptable).
  70.  
  71.        All DAC Micro Systems products are trademarks or registered trademarks
  72.        of DAC Micro Systems.  Other brand and product names are trademarks or
  73.        registered trademarks of their respective holders.
  74.  
  75.        Copyright (c)  1991, Dave  Frailey and  DAC Micro Systems.  All rights
  76.        reserved.
  77.  
  78.                                  DAC Micro Systems
  79.                                   40941 176th St E
  80.                                 Lancaster, CA  93535
  81.  
  82.                                 Voice: 805/264-1700
  83.                                  BBS: 805/264-1219
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.                                           i
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.                                     REGISTRATIONREGISTRATION
  102.  
  103.        Registering dCOM allows you to use this product after the trial period
  104.        expires for  an indefinate  period of time.  Registered dCOM users get
  105.        mailed notifications  of dCOM  updates and registered user access when
  106.        calling the dCOM Support BBS.  Most importantly, registered users know
  107.        they are  helping to  ensure that  high-quality software like dCOM can
  108.        continue to  be  distributed  in  this  low-cost  manner.    For  more
  109.        information on  ordering, refer to the REGISTER.DOC text file included
  110.        with this  package  or,  call  the  dCOM  Support  Board  for  on-line
  111.        ordering.
  112.  
  113.        This document  file is  an abridged  version of  the registered user's
  114.        type-set documentation.   There  are  many  more  macro  commands  and
  115.        variables than  are documented here.  This documentation is only meant
  116.        to provide  you with  enough familiarity  so that  you  can  determine
  117.        whether dCOM  suits your taste or requirements.  It is no way meant to
  118.        provide you  with a  reason to  continue using  dCOM on  an indefinate
  119.        basis without registering.
  120.  
  121.  
  122.                                       PREFACEPREFACE
  123.  
  124.        Webster's definition of the word "macro" in a computer-related context
  125.        is described  as "a  single computer  instruction that  stands  for  a
  126.        sequence of operations".
  127.  
  128.        When a  program provides  an automated  facility where  a sequence  of
  129.        operations can  be programmed by the user, a lot of programs today are
  130.        calling this  capability a  "script".   The term  "macro" now seems to
  131.        have been  relegated to  something that only plays-back (or simulates)
  132.        keyboard keystrokes.
  133.  
  134.        In dCOM's  case however,  the term  "macro" refers  to  an  extensible
  135.        programming language, not to keystroke playback.  A long time ago in a
  136.        land far,  far away  (roughly five  years now),  when dCOM  was just a
  137.        twinkle in  its father's eye, the term script was hardly a common term
  138.        in the PC environment.  And now, after thinking about it, "macro keys"
  139.        sounds a lot better than "script keys".
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.                                           ii
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.                                       ContentsContents
  160.  
  161.           PREFACE........................................................II
  162.  
  163.           INTRODUCTION....................................................1
  164.  
  165.           USING MACRO KEYS................................................4
  166.              General Overview.............................................5
  167.              From the File Handler........................................7
  168.  
  169.           MACRO FILES.....................................................8
  170.              Overview.....................................................9
  171.              Editing.....................................................10
  172.              File Format.................................................11
  173.                Menu Title................................................12
  174.                Comments..................................................12
  175.              AUTOEXEC.MAC................................................13
  176.              LOGIN.MAC...................................................14
  177.  
  178.           MACRO KEY DEFINITIONS..........................................15
  179.              Overview....................................................16
  180.              Function Key Definitions....................................16
  181.                Title Line Switches.......................................17
  182.              Special Definitions.........................................18
  183.                [FILEAUTO]................................................19
  184.                [MENUAUTO]................................................20
  185.                [DRIVEAUTO]...............................................21
  186.                [PUBLIC]..................................................21
  187.                [EQUATES].................................................22
  188.  
  189.           MACRO LANGUAGE.................................................23
  190.              Overview....................................................24
  191.              IF Statements...............................................26
  192.              In-Line Arithmetic..........................................28
  193.              Menus and Windows...........................................29
  194.                Menuing Switches..........................................30
  195.              Commands....................................................31
  196.                Reference.................................................32
  197.              Variables...................................................78
  198.                User Variables............................................80
  199.                  Arrays..................................................81
  200.                  Indirect Assignments....................................81
  201.                System Variables..........................................82
  202.                  Reference...............................................84
  203.              Examples...................................................101
  204.              Technical Tricks...........................................116
  205.  
  206.           MENUING.......................................................119
  207.              Overview...................................................120
  208.              The Menu Mode..............................................121
  209.              Controlling Menu Appearance................................122
  210.              Include Files..............................................123
  211.  
  212.  
  213.                                           iii
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.           ACCESS CONTROL................................................125
  221.              Overview...................................................126
  222.              Enabling...................................................127
  223.              Logging In.................................................128
  224.              Logging Out................................................129
  225.              Administration.............................................130
  226.                Rights...................................................131
  227.                Groups...................................................132
  228.              With the Macro System......................................133
  229.  
  230.           APPENDICES....................................................134
  231.              Appendix A - Using Macro Files on a Network................135
  232.              Appendix B - Batch File Interchangeability.................138
  233.              Appendix C - The Internal Macro Compiler...................139
  234.              Appendix D - ANSII Music...................................140
  235.              Appendix E - Macro Error Numbers...........................141
  236.  
  237.           INDEX.........................................................142
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.                                           iv
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.        ======================================================================
  287.  
  288.                                     INTRODUCTIONINTRODUCTION
  289.  
  290.        ======================================================================
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.                                           1
  336.  
  337.  
  338.                                                                  Introduction
  339.        ----------------------------------------------------------------------
  340.  
  341.  
  342.  
  343.  
  344.  
  345.                                     IntroductionIntroduction
  346.  
  347.        One of  the most  powerful features in dCOM is its macro facility.  It
  348.        can be  used in  a manner as simple as that of a MS-DOS batch file or,
  349.        as complex  as developing  an interactive  application in a high-level
  350.        programming language.  The choice is yours.
  351.  
  352.        If programming  isn't your  'bag', you  can still  access a lot of the
  353.        macro key functionality by only going so far as to import some of your
  354.        common batch files into a dCOM macro file so they can be accessed just
  355.        by pressing one of the 20 function keys.
  356.  
  357.        The macro  language however, can become a lot more than just having 20
  358.        different batch files on-line and ready to be executed at the touch of
  359.        a key.   They  can be  programmed to react interactively with the file
  360.        handler, using  the currently selected file, loop around tagged files,
  361.        or get  keyboard input,  test and  jump conditionally  on a variety of
  362.        operands, etc....  To begin using them though, all you have to know is
  363.        how to write a simple batch file with a text editor.
  364.  
  365.        By going a little further and learning a few of the macro commands you
  366.        can soon be writing macro keys that:
  367.  
  368.         *  Pop up  menus that  select files  or directories  before running a
  369.            program, or performing some other action on the item selected.
  370.  
  371.         *  Pop up menus of your own design which you can use to control macro
  372.            execution flow or branching.
  373.  
  374.         *  Pop up menus of commonly used applications which are then executed
  375.            simply by selecting one from the menu.
  376.  
  377.         *  Use   both single-line  IF statements  and also nestable IF blocks
  378.            which have  a full  compliment of IF..THEN, ELSE/ELSEIF, and ENDIF
  379.            statements.
  380.  
  381.         *  Use nestable  DO blocks  which loop  sequentially around each file
  382.            (or directory) that qualifies based on a given mask.
  383.  
  384.        dCOM can also be made to initially act as a front-end, mouse-sensitive
  385.        menu system  (instead of starting up as a file handler), by passing it
  386.        the /M  command line  switch.   Since the  macro system can branch off
  387.        into other  macro files, it is easy to build a sophisticated cascading
  388.        submenu structure.  For more information refer to Menuing on page 119.
  389.  
  390.        The behavior of each individual macro key can be customized with title
  391.        line switches.  For instance, if a macro key needs to temporarily load
  392.        a TSR  that is  needed by a subsequent program that the macro key will
  393.        run, but  you don't  need the TSR when the macro key finishes, you can
  394.  
  395.  
  396.                                           2
  397.  
  398.  
  399.                                                                  Introduction
  400.        ----------------------------------------------------------------------
  401.  
  402.  
  403.        give the  macro key  a /R  title line  switch to  have the TSR removed
  404.        without impacting any other TSR's loaded previously.
  405.  
  406.        Each individual  macro key  can be  protected  by  the  login  (access
  407.        control) system.   If  the login system is active and the current user
  408.        doesn't belong  to a  group that  has access to a protected macro key,
  409.        the user  won't see  the option  and can't execute the macro key.  For
  410.        more information refer to the /G title line switch.
  411.  
  412.        Each macro  key can  also be  protected with  its own unique password.
  413.        When an  attempt is  made to  run that macro key, a box pops-up asking
  414.        the user to enter the appropriate password.
  415.  
  416.        Macro keys  can be  called from  the Alarm  system  and  also  by  the
  417.        Extension Execute  Feature of  the file  handler.   Refer to  the file
  418.        handler's documentation for more information.
  419.  
  420.        The design  of the  macro  system  was  with  speed,  efficiency,  and
  421.        flexibility as  primary factors.   Each  macro file  is  automatically
  422.        compiled and 'tokenized' by an internal process to a binary load image
  423.        file when  the ASCII  macro file is changed.  The compiled macro files
  424.        are  read  into  memory  directly  when  they  haven't  been  changed.
  425.        Compiling the macro files yields a performance level almost equivalent
  426.        to a program intelligently developed in assembler.
  427.  
  428.        dCOM as  a whole (including the macro system), always reads files in a
  429.        sharing mode with as large a block size as possible.  Reading files in
  430.        a few  (or one) large blocks is much more efficient than reading files
  431.        in many  smaller blocks, especially one byte at a time in character or
  432.        line-oriented disk I/O.
  433.  
  434.        The capabilities  provided by  dCOM's macro  system are  unrivaled and
  435.        unparalleled in the PC world today.
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                           3
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.        ======================================================================
  470.  
  471.                                   USING MACRO KEYSUSING MACRO KEYS
  472.  
  473.        ======================================================================
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.                                           4
  519.  
  520.  
  521.                                           Using Macro Keys - General Overview
  522.        ----------------------------------------------------------------------
  523.  
  524.  
  525.  
  526.  
  527.  
  528.                          Using Macro Keys General OverviewUsing Macro Keys General Overview
  529.  
  530.        This section  provides basic  information about using the macro system
  531.        in general. It is applicable to all modes in which it might be used.
  532.  
  533.        The basic steps to building and using macro keys are:
  534.  
  535.         *  Understanding the format of a macro file.
  536.  
  537.         *  Create and  edit a  macro file (usually the first one you build is
  538.            DCOM.MAC).
  539.  
  540.         * Start pressing function keys.
  541.  
  542.        When you  want the  macro keys to act as a front-end menu (without the
  543.        file handler),  start dCOM  with a  /M command  line switch.   This is
  544.        called the  Menu Mode and is discussed in more detail under Menuing on
  545.        page 119.
  546.  
  547.        When a menu of the macro key titles is displayed on the screen (either
  548.        because the  menu mode  is active, or the Backspace key was pressed in
  549.        the file handler), a macro key can be selected and executed in several
  550.        ways:
  551.  
  552.         *  You can always just press the appropriate function key.
  553.  
  554.         *  If you  like the mouse, you can click the left button on the title
  555.            of the key you want to execute.
  556.  
  557.         *  If you  like to  use the cursor keys, you can use the keypad arrow
  558.            keys to  move the  selection bar  (it won't appear until the first
  559.            time you  use one  of the  arrow keys) to the title of the key you
  560.            want, and then press Return.
  561.  
  562.         *  You can  press the  first letter  of a  macro key's  title and the
  563.            selection bar  will highlight  the first  one found.  If more than
  564.            one macro  title begins  with the  same letter,  press the  letter
  565.            again until the right title is selected - then press Return.
  566.  
  567.        When a  macro key  is executed, dCOM automatically manages when and if
  568.        the screen  is initially  cleared.   There is no need to start a macro
  569.        key with  a CLS  instruction just  to remove  the file handler or menu
  570.        mode's screen.   For  example, if  all a  macro  key  does  is  change
  571.        directories, the  screen will  never clear  automatically, making  the
  572.        transition almost seamless.
  573.  
  574.        Pressing Ctrl-C will abort macro execution as long as the macro is not
  575.        running another  program.   If a  macro is running another program and
  576.        the Ctrl-C  causes the  program to  terminate, the macro key will also
  577.  
  578.  
  579.                                           5
  580.  
  581.  
  582.                                           Using Macro Keys - General Overview
  583.        ----------------------------------------------------------------------
  584.  
  585.  
  586.        terminate.   dCOM's background  keyboard handler  always knows  when a
  587.        Ctrl-C sequence  has been  pressed.   The macro  engine running in the
  588.        foreground checks  the background  handler for  a Ctrl-C every time it
  589.        executes a new line.
  590.  
  591.        All macro  commands that  pause for  keyboard input  will react to the
  592.        Escape key  by aborting  execution of  the current  macro  definition.
  593.        This includes  all of  the menuing-type commands as well.  This action
  594.        can be  circumvented however,  by trapping  the  Escape  key  with  an
  595.        ONBREAKGOTO macro command.
  596.  
  597.        When the  macro system  encounters an  error during the execution of a
  598.        macro, a  message will pop-up with a beep describing the error and the
  599.        line that  produced it.   After  you cancel  the message  by  pressing
  600.        Return or  Escape, the macro will terminate and control will return to
  601.        either the file handler or menu mode.
  602.  
  603.        Sometimes you  may need a macro key to display a pause message when it
  604.        terminates so  that what it has displayed won't be immediately covered
  605.        by the  file handler's  screen or  the menu  mode's screen.   This  is
  606.        usually the  case when a macro runs a program that displays something,
  607.        but didn't  prompt for  any type  of response  before it exited.  In a
  608.        batch file  you could  use a PAUSE command as the last statement to do
  609.        this (which  you can  also do  with a  macro key), but there is also a
  610.        macro title  line switch,  /W, which  does this  in  a  slightly  more
  611.        aesthetic manner  and allows  the file  handler to concurrently reload
  612.        its overlay (if necessary) in the meantime.
  613.  
  614.        There are  several other  title line switches available that allow you
  615.        to customize  the behavior  of each  individual macro  key.   For more
  616.        information refer to Title Line Switches on page 17.
  617.  
  618.        Available disk space is the only limiting factor to how many different
  619.        macro files you can create and use.  By default, DCOM.MAC is the first
  620.        one loaded  and active.   From  the file  handler you  can temporarily
  621.        branch off  to a  macro file different from the currently active macro
  622.        file by  using its  "/" command.  From within the menu mode, you would
  623.        have to build options to call other macro files by using macro keys in
  624.        the current  macro file  to branch  to them.   For instance, you could
  625.        build a  macro file  that performs  all of your disk utility functions
  626.        (like formatting,  copying, etc...)  and then  quickly call  it up  by
  627.        pressing the  "/" key  and selecting  that macro  file from the pop-up
  628.        menu.   The point is, if you have a lot of varied and different things
  629.        for macro  keys to  do, its  probably a  good idea  to  separate  them
  630.        logically into different macro files.
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.                                           6
  641.  
  642.  
  643.                                      Using Macro Keys - From the File Handler
  644.        ----------------------------------------------------------------------
  645.  
  646.  
  647.  
  648.  
  649.  
  650.                        Using Macro Keys From the File HandlerUsing Macro Keys From the File Handler
  651.  
  652.        This section  discusses the  macro system  while the  file handler  is
  653.        active.   For information on using the macro system when the Menu Mode
  654.        is active, refer to Menuing on page 119.
  655.  
  656.        Anytime the  file handler  is in  its main  screen  (where  you  copy,
  657.        delete, rename,  etc...), you can execute a macro key just by pressing
  658.        its function  key.   If you can't remember which function key executes
  659.        the macro  you want,  you can  press the  Backspace key to get a quick
  660.        pop-up overlay  of the macro key titles.  The pop-up overlay reacts to
  661.        all of  the methods of triggering a macro key that are described under
  662.        General Overview.
  663.  
  664.        You can  temporarily call  (gosub) a  different macro file by pressing
  665.        the "/"  (forward slash)  key.   A pop-up  menu of  that macro  file's
  666.        titles will  then display in the same manner as if you had pressed the
  667.        Backspace key.  The original macro file will be automatically reloaded
  668.        if you  Escape the  menu or  after you  run  one  of  the  macro  keys
  669.        displayed.  For mouse users, clicking the mouse left button on the "M-
  670.        File" option  in the  sidebar menu has the same effect as pressing the
  671.        "/" key.
  672.  
  673.        You can  permanently change  (goto)  to  a  different  macro  file  by
  674.        pressing the  "." (period)  key.   When the  "." key is used to change
  675.        macro files,  the macro  menu overlay is automatically invoked to help
  676.        you make a selection from the new macro file (unless you are returning
  677.        to the  original default  macro file).  When you are done with the new
  678.        macro file's  overlay menu though, the new macro file will stay loaded
  679.        in memory until you change it again with the "." command.
  680.  
  681.        When a  different macro file is active than the original default macro
  682.        file, the  bottom right corner of the file handler's screen (the Drive
  683.        Select Box) will constantly display the name of the current macro file
  684.        to help  remind you  that a different set of macro keys is active than
  685.        that which you're probably used to.
  686.  
  687.        Several system  variables are provided that facilitate writing a macro
  688.        key so  that it  can work  interactively with  the file handler.  They
  689.        allow you  to write  macro keys  that know  the name  of the currently
  690.        selected file,  or tagged  files.   The most  common of these are %FN,
  691.        %FE, %TN,  and %TE.   For more information refer to Macro Variables on
  692.        page 78
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.                                           7
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.        ======================================================================
  714.  
  715.                                     MACRO FILESMACRO FILES
  716.  
  717.        ======================================================================
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.                                           8
  763.  
  764.  
  765.                                                        Macro Files - Overview
  766.        ----------------------------------------------------------------------
  767.  
  768.  
  769.  
  770.  
  771.  
  772.                                 Macro Files OverviewMacro Files Overview
  773.  
  774.        dCOM macro  files are ASCII text files which can be subdivided into as
  775.        many as 20 different macro key definitions (F1 through F10, and Shift-
  776.        F1 through  Shift-F10).    Along  with  the  20  function  keys,  some
  777.        additional special  definitions are  provided that allow you to define
  778.        macro code  which executes  automatically  under  certain  conditions.
  779.        Macro key definitions are described in the next section.
  780.  
  781.        Macro files  can be edited with any text editor.  But, if you edit the
  782.        currently active  macro file  with a  text editor  other  than  dCOM's
  783.        internal editor,  new changes  won't be  detected until  dCOM  changes
  784.        macro files or you restart dCOM.
  785.  
  786.        The first permanent macro file loaded initially by default is DCOM.MAC
  787.        unless otherwise  specified with the /MF=macrofile command line switch
  788.        when dCOM is run.
  789.  
  790.        There are  some special  macro files which dCOM will automatically run
  791.        under certain  conditions (e.g.  AUTOEXEC.MAC and  LOGIN.MAC), if they
  792.        exist.  They are further described later on in this section.
  793.  
  794.        Macro  files  are  assumed  to  be  located  in  the  same  drive  and
  795.        subdirectory in which dCOM is installed (the Home Directory), unless a
  796.        specific path is given to the contrary.
  797.  
  798.        Macro files  must have  a .MAC extension.  All commands that deal with
  799.        macro filenames  will automatically  append a  .MAC extension if it is
  800.        not given or, if a different extension is specified.
  801.  
  802.        The ASCII macro files are automatically compiled and tokenized on-the-
  803.        fly when  they have been modified.  Label references are also resolved
  804.        by the compiler to further optimize the runtime environment.
  805.  
  806.        The internal  macro compiler  uses a  form of turbo indexing, which in
  807.        most cases  compiles a  macro file  so fast that its hard to notice it
  808.        even occurred.   The compiler is internally invoked when an attempt is
  809.        made to  load a macro file that's been modified since the last time it
  810.        was compiled.   This  is detected  by comparing  the date of the ASCII
  811.        macro file against the date of the compiled macro file (compiled macro
  812.        files are  hidden files  which have  the same  name as  the ASCII .MAC
  813.        file, but have a .CMF extension).
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.                                           9
  824.  
  825.  
  826.                                                         Macro Files - Editing
  827.        ----------------------------------------------------------------------
  828.  
  829.  
  830.  
  831.  
  832.  
  833.                                 Editing a Macro FileEditing a Macro File
  834.  
  835.        To facilitate editing a macro file when the current drive or directory
  836.        is not where dCOM is installed, the file handler provides a convenient
  837.        command (Alt-K)  which allows  you to quickly select and edit existing
  838.        macro files in dCOM's Home Directory, or to create a new macro file in
  839.        that directory.
  840.  
  841.        After you select a macro file with Alt-K, dCOM invokes its text editor
  842.        and loads  the macro  file into the next available buffer.  If you had
  843.        previously quit  the editor  with its Alt-Q command, previously edited
  844.        files are  still loaded  in the editor and can be accessed by pressing
  845.        F2, F3, or F4.
  846.  
  847.  
  848.                               Using dCOM's Text EditorUsing dCOM's Text Editor
  849.  
  850.        Once inside  dCOM's editor,  its use  is fairly straight-forward.  Use
  851.        the cursor  (arrow) keys  to move  around and  change the  file.  When
  852.        finished making  changes, use  Alt-W to  write (save) the file and use
  853.        Alt-X to  exit the  editor.   If you  had started a new file using the
  854.        "[NewFile]" selection of Alt-K, pressing Alt-W will stop and ask for a
  855.        filename before proceeding (remember to give it a .MAC extension).
  856.  
  857.        Some of the more advanced features are:
  858.  
  859.         *  Use F8  to mark  the starting  and ending  lines of  a  block  for
  860.            subsequent copying  or moving  with Alt-C  or Alt-M  respectively.
  861.            (You can  also mark  lines by  holding the  Shift key  down  while
  862.            moving the cursor keys.)
  863.  
  864.         *  Press F7 or Alt-H to bring up the editor's help screen.
  865.  
  866.         *  Use Alt-D or Alt-I to delete a line or insert a line.  (Notice how
  867.            everything correlates...?)  To delete characters, use the Del key.
  868.            To change the insert/overtype mode, use the Ins key.
  869.  
  870.         *  You can  open (or  switch to)  other windows by using the function
  871.            keys F2,  F3 and  F4.   Another existing file can be loaded into a
  872.            different window using the Alt-E command.  Blocks of text from the
  873.            new window  may be  copied or moved from window to window by using
  874.            F8 to  mark the  source lines,  switch to  the destination  window
  875.            (using F1 through F4), and then using the Alt-C or Alt-M commands,
  876.            respectively.
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.                                           10
  885.  
  886.  
  887.                                                     Macro Files - File Format
  888.        ----------------------------------------------------------------------
  889.  
  890.  
  891.  
  892.  
  893.  
  894.                                  Macro File FormatMacro File Format
  895.  
  896.        An example of the basic format of a simple macro file is:
  897.  
  898.  
  899.        ,---------------------------------------------------------------------,
  900.         MAIN MACRO'S                           ;;MENU TITLE       |                                                                     |
  901.        |                                                                     |
  902.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  903.              C: ;;CHANGE DRIVES (IF NEC)       |                                                                     |
  904.              CD \MSWORD                        ;;CHANGE DIRECTORIES       |                                                                     |
  905.              WORD                              ;;RUN MS-WORD       |                                                                     |
  906.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  907.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  908.        |                                                                     |
  909.         [F2] dBASE                             ;;TITLE LINE AND SWITCHES       |                                                                     |
  910.              C: ;;CHANGE DRIVES (IF NEC)       |                                                                     |
  911.              CD \DBASE                         ;;CHANGE DIRECTORIES       |                                                                     |
  912.              DBASE                             ;;RUN dBASE       |                                                                     |
  913.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  914.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  915.        |                                                                     |
  916.              .       |                                                                     |
  917.              .       |                                                                     |
  918.              .       |                                                                     |
  919.        |                                                                     |
  920.         [sF10]  WORDSTAR                       ;;TITLE LINE AND SWITCHES       |                                                                     |
  921.              C: ;;CHANGE DRIVES (IF NEC)       |                                                                     |
  922.              CD \WS5                           ;;CHANGE DIRECTORIES       |                                                                     |
  923.              WS ;;RUN WORDSTAR       |                                                                     |
  924.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  925.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  926.        `---------------------------------------------------------------------'
  927.  
  928.        The format  of a  macro file  is very "loose".  The one shown above is
  929.        only an  example.   It has the body of each macro key indented one tab
  930.        stop and has comments on each line - neither of which are necessary.
  931.  
  932.        The use  of lower  or upper  case  is  subjective.    dCOM  is  always
  933.        insensitive to the use of case.
  934.  
  935.        Blank lines  have no  functional significance  and consume  no memory.
  936.        Use them as desired to aid in readability.
  937.  
  938.        Leading and  trailing spaces  are ignored  and consume  no  additional
  939.        memory (indent to your hearts content for purposes of clarity).
  940.  
  941.  
  942.  
  943.  
  944.  
  945.                                           11
  946.  
  947.  
  948.                                                     Macro Files - File Format
  949.        ----------------------------------------------------------------------
  950.  
  951.  
  952.                                      Menu TitleMenu Title
  953.  
  954.        The first non-blank line encountered before the start of any macro key
  955.        definition is  considered the  menu title,  with one  exception -  the
  956.        macro INCLUDE command.
  957.  
  958.        Most  likely   you  won't  use  an  INCLUDE  statement  as  the  first
  959.        significant line  in a  macro file, but if you do, you'll then have to
  960.        use an explicit MENUTITLE statement on a subsequent line to define the
  961.        menu title.
  962.  
  963.        Each macro  file can  only have  one menu title.  The menu title has a
  964.        maximum displayable length of 40 characters.  It is displayed centered
  965.        in the  top of  the macro  menu, above  the macro  key titles.  A menu
  966.        title can include macro variables.
  967.  
  968.  
  969.                                       CommentsComments
  970.  
  971.        Comments in  a macro  file are supported but not required.  They begin
  972.        when two  semicolons are  encountered in  sequence  and  automatically
  973.        terminate when  the end of line is encountered.  Comments (and tabs or
  974.        spaces leading  to a  comment) are  ignored when  the  macro  file  is
  975.        compiled and consume no additional memory.
  976.  
  977.        If a  comment starts at the beginning of a line, a single semicolon is
  978.        all that  is needed  to start the comment.  Using two semicolon's will
  979.        have no adverse affect however.
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.                                           12
  1007.  
  1008.  
  1009.                                                    Macro Files - AUTOEXEC.MAC
  1010.        ----------------------------------------------------------------------
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.                                     AUTOEXEC.MACAUTOEXEC.MAC
  1017.  
  1018.        If there  is a  file called  AUTOEXEC.MAC in dCOM's Home Directory, it
  1019.        will be  called and executed automatically when dCOM starts up.  It is
  1020.        executed only once, before any other macro files which might be set to
  1021.        run with a /MF, and /F# command line switches.
  1022.  
  1023.        AUTOEXEC.MAC does  not execute  when a  multiple copy of dCOM is being
  1024.        run.
  1025.  
  1026.        When AUTOEXEC.MAC  is executed, it normally doesn't have any affect on
  1027.        what ends  up as  the default  macro file unless it itself changes the
  1028.        current macro file with a GOTOMF command.
  1029.  
  1030.        The format  of AUTOEXEC.MAC  does not require a title line like normal
  1031.        macro files.   Without  a title  line, its  contents are automatically
  1032.        assumed to  be the F1 key, which is the key dCOM executes when it runs
  1033.        AUTOEXEC.MAC.     If  you   define  other   keys  subsequently  within
  1034.        AUTOEXEC.MAC, they  won't run  automatically, but they could be called
  1035.        by the main macro body.
  1036.  
  1037.        Normally you just write it like a normal batch file with what you want
  1038.        executed, (of  course all  of the  extended macro  commands  are  also
  1039.        available).
  1040.  
  1041.        Macro code  executes much  faster than  batch files  do, so if you run
  1042.        dCOM as your primary shell you may want AUTOEXEC.MAC doing most of the
  1043.        things AUTOEXEC.BAT would do.
  1044.  
  1045.        If your  are running  dCOM as  the primary  shell, TSR's should not be
  1046.        loaded in  either the  AUTOEXEC.BAT or  AUTOEXEC.MAC, they  should  be
  1047.        loaded by  AUTOLOAD.SYS.   Refer to  the dCOM  User's Guide  for  more
  1048.        Information.
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.                                           13
  1068.  
  1069.  
  1070.                                                       Macro Files - LOGIN.MAC
  1071.        ----------------------------------------------------------------------
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.                                      LOGIN.MACLOGIN.MAC
  1078.  
  1079.        When the  Login system  is active (dCOM's /L command line switch), and
  1080.        if there  is a file called LOGIN.MAC in dCOM's Home Directory, it will
  1081.        be loaded automatically as the current macro file when a new user logs
  1082.        in (any macro files saved on the gosub stack are discarded).
  1083.  
  1084.        If the  Login system  is not active, the existence of LOGIN.MAC has no
  1085.        affect.
  1086.  
  1087.        If you wish to automatically execute some macro code immediately after
  1088.        a new  login (for  instance to  then load  a personalized  macro  file
  1089.        depending on who the user is), write the macro code under a [FILEAUTO]
  1090.        definition in LOGIN.MAC.
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.                                           14
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.        ======================================================================
  1141.  
  1142.                                MACRO KEY DEFINITIONSMACRO KEY DEFINITIONS
  1143.  
  1144.        ======================================================================
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.                                           15
  1190.  
  1191.  
  1192.                                                         Macro Key Definitions
  1193.        ----------------------------------------------------------------------
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.                            Macro Key Definitions OverviewMacro Key Definitions Overview
  1200.  
  1201.        A macro  file is  logically separated  by  one  or  more  definitions.
  1202.        Function key  definitions define  a portion  of the  macro  file  that
  1203.        executes when that function key is invoked.  Other definitions provide
  1204.        special features and are described a little later on.
  1205.  
  1206.  
  1207.                               Function Key DefinitionsFunction Key Definitions
  1208.  
  1209.        Each function key definition is started with a title line that has the
  1210.        following format:
  1211.  
  1212.             [F#] title [/switches]
  1213.  
  1214.        The bracket  characters around "F#" are mandatory and serve as a means
  1215.        to identify  the start of a new function key definition.  The brackets
  1216.        surrounding "/switches"  are used to indicate that optional title line
  1217.        switches may  be specified after the title.  You would not include the
  1218.        brackets if you were using one of the switches.  For example:
  1219.  
  1220.             [F1] WordPerfect /w
  1221.  
  1222.        The allowable  function key  definitions are  [F1] through  [F10], and
  1223.        [sF1] through [sF10] (the "s" designates shifted function keys).
  1224.  
  1225.        Each function  key title  has  a  maximum  displayable  length  of  20
  1226.        characters; exceeding this only causes it to be truncated.  A function
  1227.        key title can include macro variables.
  1228.  
  1229.        The lines  that follow  the title  line are what make up the body of a
  1230.        macro key.   There  is no  command which  marks the end of a macro key
  1231.        definition.   The next  title line of another macro key is the implied
  1232.        end of the preceding macro key (or the end of file).
  1233.  
  1234.        Function key  definitions  need  not  be  defined  in  any  particular
  1235.        sequence.   Defining them  out of  order however,  can  have  a  minor
  1236.        degradation on  performance  when  the  macro  file  is  automatically
  1237.        recompiled and, could become somewhat confusing.
  1238.  
  1239.        Duplicate function  key definitions  are illegal  and will  produce an
  1240.        error when either one is executed.
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.                                           16
  1251.  
  1252.  
  1253.                                                         Macro Key Definitions
  1254.        ----------------------------------------------------------------------
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.                                 Title Line SwitchesTitle Line Switches
  1261.  
  1262.        The characteristics  of each  macro key  can be  altered by the use of
  1263.        optional title  line switches.   These  switches are  specified on the
  1264.        same line that defines the macro key, following the text of its title.
  1265.  
  1266.        /W/W          Specifies that  a pause (wait) is necessary when the macro
  1267.                    terminates.   This switch  is needed  when the  macro does
  1268.                    something that  needs to  be seen,  but  whatever  did  it
  1269.                    doesn't wait  for user  response before  exiting (e.g. the
  1270.                    MS-DOS DIR  command).   If you  don't tell  dCOM that  the
  1271.                    macro key  needs a  pause, it will just go ahead and build
  1272.                    the screen  for whatever  comes next,  none the wiser that
  1273.                    you wanted  to read  it.  An alternate way to achieve this
  1274.                    effect, but  on a  conditional basis, is to not use the /W
  1275.                    switch so that overall the macro won't pause, but when you
  1276.                    do want  it to pause use the %W variable on any macro line
  1277.                    that accepts  parameters (%W  is more  like a  switch, and
  1278.                    used primarily with the Extension Execute feature).
  1279.  
  1280.        /R/R          This switch  tells dCOM  to remove any TSR's loaded by the
  1281.                    macro key  when the  macro key terminates.  This is useful
  1282.                    if you  need to  load a  TSR to support a program which is
  1283.                    also run in the same macro key, but you don't need the TSR
  1284.                    after the macro key is finished.
  1285.  
  1286.        /P:pword/P:pword    Specifies that  the macro  key is password protected.  The
  1287.                    password specified  following the  colon is  then required
  1288.                    before a  user can  execute the  macro key.   The  maximum
  1289.                    recognized length  of a password is 10 characters.  If you
  1290.                    use password's on your macro keys, it might be a good idea
  1291.                    to hide  the macro  files (using  the file handler's Alt-H
  1292.                    command) since  the password can easily be seen by viewing
  1293.                    the macro file.  If you hide a macro file, it will have no
  1294.                    ill-effect on  any of  the  commands  that  involve  macro
  1295.                    files.
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.                                           17
  1312.  
  1313.  
  1314.                                               Macro Key Definitions - Special
  1315.        ----------------------------------------------------------------------
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.                                 Special DefinitionsSpecial Definitions
  1322.  
  1323.        Several additional  macro definitions  may also  be defined  within  a
  1324.        macro file  other than  function key  definitions.   These definitions
  1325.        have a  syntax similar  to function  key definitions  in that they are
  1326.        surrounded by  square brackets  - but they normally do not also have a
  1327.        title, or title line switches.
  1328.  
  1329.        For example:
  1330.  
  1331.        ,---------------------------------------------------------------------,
  1332.         MAIN MACRO'S                           ;;MENU TITLE       |                                                                     |
  1333.        |                                                                     |
  1334.         [MENUAUTO]                             ;;RUNS BEFORE MENU DISPLAYS[MENUAUTO]                             ;;RUNS BEFORE MENU DISPLAYS       |                                                                     |
  1335.              CLS 3,1,176                       ;;CLEAR SCREEN IN NICE COLORS     CLS 3,1,176                       ;;CLEAR SCREEN IN NICE COLORS       |                                                                     |
  1336.              MENUCOLOR 0,3,14,4,1              ;;OVERRIDE DEFLT MENU COLORS     MENUCOLOR 0,3,14,4,1              ;;OVERRIDE DEFLT MENU COLORS       |                                                                     |
  1337.        |                                                                     |
  1338.         [PUBLIC]                               ;;PUBLIC PROCEDURES[PUBLIC]                               ;;PUBLIC PROCEDURES       |                                                                     |
  1339.           :SETWINPATH                          ;;SET WINDOWS PATH PROC.  :SETWINPATH                          ;;SET WINDOWS PATH PROC.       |                                                                     |
  1340.              %TPATH=%[PATH]                    ;;SAVE CURR PATH IN %TPATH     %TPATH=%[PATH]                    ;;SAVE CURR PATH IN %TPATH       |                                                                     |
  1341.              SET PATH=C:\WINDOWS;C:\WINAPPS\WINWORD ;;SET PATH FOR WIN&APPS     SET PATH=C:\WINDOWS;C:\WINAPPS\WINWORD ;;SET PATH FOR WIN&APPS       |                                                                     |
  1342.              SET PATH=%[PATH];C:\WINAPPS\AMIPRO     ;;ADD ON PATH FOR AMIPRO     SET PATH=%[PATH];C:\WINAPPS\AMIPRO     ;;ADD ON PATH FOR AMIPRO       |                                                                     |
  1343.              RETURN                            ;;RETURN TO CALLER     RETURN                            ;;RETURN TO CALLER       |                                                                     |
  1344.           :RMVWINPATH                          ;;REMOVE WINDOWS PATH PROC.  :RMVWINPATH                          ;;REMOVE WINDOWS PATH PROC.       |                                                                     |
  1345.              SET PATH=%TPATH                   ;;RESTORE ORIGINAL PATH     SET PATH=%TPATH                   ;;RESTORE ORIGINAL PATH       |                                                                     |
  1346.              RETURN                            ;;RETURN TO CALLER     RETURN                            ;;RETURN TO CALLER       |                                                                     |
  1347.        |                                                                     |
  1348.              .       |                                                                     |
  1349.              .       |                                                                     |
  1350.        |                                                                     |
  1351.         [F1] WINDOWS                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  1352.              CDD C:\WINDOWS\FILES              ;;CHANGE DRIVE & DIRECTORIES       |                                                                     |
  1353.              GOSUB SETWINPATH                  ;;SET PATH FOR WINDOWS       |                                                                     |
  1354.              WIN%XM                            ;;RUN WINDOWS & SWAP OUT DCOM       |                                                                     |
  1355.              GOSUB RMVWINPATH                  ;;REMOVE PATH CHANGES       |                                                                     |
  1356.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  1357.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  1358.        |                                                                     |
  1359.              .       |                                                                     |
  1360.              .       |                                                                     |
  1361.        |                                                                     |
  1362.        `---------------------------------------------------------------------'
  1363.  
  1364.        In the  example above two special definitions are used, [MENUAUTO] and
  1365.        [PUBLIC].  While this might be a good example of how to run Windows in
  1366.        a dCOM macro key, its primary intent is to indicate how to use special
  1367.        definitions.
  1368.  
  1369.  
  1370.  
  1371.  
  1372.                                           18
  1373.  
  1374.  
  1375.                                               Macro Key Definitions - Special
  1376.        ----------------------------------------------------------------------
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.                                      [FILEAUTO][FILEAUTO]
  1383.  
  1384.        A [FILEAUTO]  definition executes  once, immediately  after the  macro
  1385.        file is loaded, irregardless of whether the menu mode is active.  If a
  1386.        macro file  calls another  macro file,  when control  returns  to  the
  1387.        original macro file the [FILEAUTO] definition will re-execute.
  1388.  
  1389.        Normally you  would not  use a  RETURN statement  to end  a [FILEAUTO]
  1390.        definition, unless  the entire  purpose of  the macro  file is to be a
  1391.        [FILEAUTO] definition  (acting as a significant subroutine or program)
  1392.        and you then want control to return to a calling macro file.
  1393.  
  1394.        If you  develop some  macro code that does some serious processing, it
  1395.        may be  easier to  write it  all in  a separate  macro  file  under  a
  1396.        [FILEAUTO] definition.   This  allows your macro code to be called and
  1397.        executed simply  by using  a GOSUBMF command in the active macro file.
  1398.        The advantages  are that  its simpler  to initially  install, and also
  1399.        easier to  circulate updated  versions, especially  on someone  else's
  1400.        computer.
  1401.  
  1402.        The location  of a  [FILEAUTO] definition  can be  anywhere in a macro
  1403.        file.   Logically though, it would probably make more sense to have it
  1404.        near the start.
  1405.  
  1406.        Labels within  a [FILEAUTO]  definition can be referred to by external
  1407.        macro    definitions    by    using    a    syntax    of    "FA:label"
  1408.        (i.e. GOSUB FA:LABEL1).
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.                                           19
  1434.  
  1435.  
  1436.                                               Macro Key Definitions - Special
  1437.        ----------------------------------------------------------------------
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.                                      [MENUAUTO][MENUAUTO]
  1444.  
  1445.        A [MENUAUTO]  definition only executes if the menu mode is active, and
  1446.        does so  immediately before  the menu  is about to be displayed - each
  1447.        and every time.
  1448.  
  1449.        The original  intent of  the [MENUAUTO]  definition was  to provide  a
  1450.        means to  alter the appearance of the menu mode, but that's not to say
  1451.        you can't use the opportunity to execute other macro code.
  1452.  
  1453.        The location  of a  [MENUAUTO] definition  can be  anywhere in a macro
  1454.        file.   Logically though, it would probably make more sense to have it
  1455.        near the start.
  1456.  
  1457.        An example of [MENUAUTO] is:
  1458.  
  1459.        ,---------------------------------------------------------------------,
  1460.         MAIN MACRO'S                           ;;MENU TITLE       |                                                                     |
  1461.        |                                                                     |
  1462.         [MENUAUTO]                             ;;RUNS BEFORE MENU DISPLAYS       |                                                                     |
  1463.              CLS 0,1,176                       ;;CLS IN BLACK ON BLUE w/'░'       |                                                                     |
  1464.              WINDOW 1,1,4,80,1,7,1,1           ;;DISPLAY A BOX ON THE SCREEN       |                                                                     |
  1465.                                                ;; AND THEN DISPLAY VER INFO       |                                                                     |
  1466.              ECHO dCOM Menu System Ver %SS(%DV,1,1).%SS(%DV,2,2);       |                                                                     |
  1467.              CPOSN ,78                         ;;POSITION TO RIGHT EDGE       |                                                                     |
  1468.                                                ;; & DISPLAY DATE & TIME       |                                                                     |
  1469.              ECHOR %DW, %MY %SS(%DT,4,2), 19%SS(%DT,7,2)  %TI;       |                                                                     |
  1470.              CLOCK %CL,%CC-8                   ;;TURN CLOCK ON       |                                                                     |
  1471.              CPOSN 3,3                         ;;MOVE CURSOR TO NEXT LINE       |                                                                     |
  1472.              ECHO Current User %LN;            ;;DISPLAY USER NAME       |                                                                     |
  1473.              CPOSN ,78                         ;;POSITION TO RIGHT EDGE       |                                                                     |
  1474.                                                ;; & DISPLAY FREE DISK SPACE       |                                                                     |
  1475.              ECHOR %FC(%FD(C)) Free of %FC(%TD(C)) On Drive C:       |                                                                     |
  1476.              RSTWIN /N                         ;;FREE WINDOW, LEAVE SCREEN       |                                                                     |
  1477.              MENUSTART 8,14                    ;;SET MENU DISPLAY POSITION       |                                                                     |
  1478.              MENUCOLOR 0,3,1,14,2              ;;SET MENU COLORS/BORDER TYPE       |                                                                     |
  1479.        |                                                                     |
  1480.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  1481.              CDD C:\MSWORD                     ;;CHANGE DRIVE & DIRECTORIES       |                                                                     |
  1482.              WORD                              ;;RUN MS-WORD       |                                                                     |
  1483.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  1484.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  1485.        |                                                                     |
  1486.              .       |                                                                     |
  1487.              .       |                                                                     |
  1488.        |                                                                     |
  1489.        `---------------------------------------------------------------------'
  1490.  
  1491.  
  1492.  
  1493.  
  1494.                                           20
  1495.  
  1496.  
  1497.                                               Macro Key Definitions - Special
  1498.        ----------------------------------------------------------------------
  1499.  
  1500.  
  1501.        The example  above uses  the author's  favorite color scheme.  Another
  1502.        popular set  of colors can be had by substituting the CLS, WINDOW, and
  1503.        MENUCOLOR commands with these:
  1504.  
  1505.             CLS 3,1,176
  1506.             WINDOW 1,1,4,80,1,3,1,1
  1507.             MENUCOLOR 15,1,11,14,2
  1508.  
  1509.        Labels within  a [MENUAUTO]  definition can be referred to by external
  1510.        macro    definitions    by    using    a    syntax    of    "MA:label"
  1511.        (i.e. GOSUB MA:LABEL1).
  1512.  
  1513.  
  1514.  
  1515.                                     [DRIVEAUTO][DRIVEAUTO]
  1516.  
  1517.        A [DRIVEAUTO] definition automatically executes every time the default
  1518.        drive is  changed.   Don't ask  me what the proposed usefulness is, it
  1519.        was implemented as part of a deal with another user who wanted it.
  1520.  
  1521.        Labels within  a [DRIVEAUTO] definition can be referred to by external
  1522.        macro    definitions    by    using    a    syntax    of    "DA:label"
  1523.        (i.e. GOSUB DA:LABEL1).
  1524.  
  1525.  
  1526.                                       [PUBLIC][PUBLIC]
  1527.  
  1528.        Using a [PUBLIC] definition provides a way to group common subroutines
  1529.        under one  definition.   Labels used  under a  [PUBLIC] definition are
  1530.        available to all definitions in a macro file.
  1531.  
  1532.        If the  same label  name is  defined both in a [PUBLIC] definition and
  1533.        locally, the local definition's label will be used.
  1534.  
  1535.        Label names  defined under  any other  type of definition are normally
  1536.        private to  that definition.   This  allows labels of the same name to
  1537.        exist in  several definitions  without causing  a  conflict.    It  is
  1538.        possible though to call a label in a different definition by preceding
  1539.        the label's  name with  the name  of  the  external  definition  (i.e.
  1540.        GOSUB F1:MYPROC).   But this  method of  calling external  subroutines
  1541.        could soon become awkward.
  1542.  
  1543.        A [PUBLIC]  definition can  be defined more than once in a macro file.
  1544.        If it  is, subsequent occurrences are simply appended to the currently
  1545.        built definition.   This  could be  useful if  you  have  some  public
  1546.        routines in  a separate  file linked  in with  an INCLUDE command, but
  1547.        still want to have some public routines which are written in the local
  1548.        macro file.
  1549.  
  1550.        An example  of using  the [PUBLIC] definition is shown at the start of
  1551.        this section on page 18.
  1552.  
  1553.  
  1554.  
  1555.                                           21
  1556.  
  1557.  
  1558.                                               Macro Key Definitions - Special
  1559.        ----------------------------------------------------------------------
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.                                      [EQUATES][EQUATES]
  1566.  
  1567.        Unlike other  types of macro definitions, an [EQUATES] definition does
  1568.        not contain executable macro code, it defines static user variables.
  1569.  
  1570.        These are  actually not  variables though, they are more like aliases.
  1571.        But for  our purposes  we'll call  them equate  variables.   These are
  1572.        variables that cannot be changed once they are defined.  Their purpose
  1573.        is to allow something that might be changed frequently to be expressed
  1574.        only once, making it easy to change by not having to search the entire
  1575.        macro file for all occurrences of the literal text.
  1576.  
  1577.        Equate variables  must start  with a  "%$" sequence.  After that, they
  1578.        must follow the rules of regular variable names which can only contain
  1579.        the letters A-Z, 0-9, and the underscore.
  1580.  
  1581.        Equate  variables   are  actually   resolved   and   expanded   during
  1582.        compilation, not  during runtime.    Therefore,  unlike  regular  user
  1583.        variables, the  size of their name has no affect on memory usage.  But
  1584.        the size  of their  value does,  because the load (runtime) image will
  1585.        contain a  copy of  their value in every occurrence in which they were
  1586.        used.
  1587.  
  1588.        Equate variables  currently cannot use another equate variable as part
  1589.        of their value.
  1590.  
  1591.        An [EQUATE]  definition can be defined more than once in a macro file.
  1592.        If it  is, subsequent occurrences are simply appended to the currently
  1593.        built variable list.
  1594.  
  1595.        A simplistic example of using [EQUATES] is:
  1596.  
  1597.        ,---------------------------------------------------------------------,
  1598.         MAIN MACRO'S                           ;;MENU TITLE       |                                                                     |
  1599.        |                                                                     |
  1600.         [EQUATES]                              ;;START OF EQUATE VARIABLES       |                                                                     |
  1601.              %$WORD_DIR=C:\MSWORD              ;; SET %$WORD_DIR VARIABLE       |                                                                     |
  1602.              %$WINDOWS_DIR=C:\WINDOWS          ;; SET %$WINDOWS_DIR VARIABLE       |                                                                     |
  1603.        |                                                                     |
  1604.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  1605.              CDD %$WORD_DIR                    ;;CHANGE DRIVE & DIRECTORIES       |                                                                     |
  1606.              WORD                              ;;RUN MS-WORD       |                                                                     |
  1607.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  1608.        |                                                                     |
  1609.              .       |                                                                     |
  1610.              .       |                                                                     |
  1611.        |                                                                     |
  1612.        `---------------------------------------------------------------------'
  1613.  
  1614.  
  1615.  
  1616.                                           22
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.        ======================================================================
  1629.  
  1630.                                    MACRO LANGUAGEMACRO LANGUAGE
  1631.  
  1632.        ======================================================================
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.                                           23
  1678.  
  1679.  
  1680.                                                     Macro Language - Overview
  1681.        ----------------------------------------------------------------------
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.                               Macro Language OverviewMacro Language Overview
  1688.  
  1689.        The macro language is a set of commands that the macro engine directly
  1690.        recognizes and  executes.   While in  some ways  it may  seem like  an
  1691.        interpreted language,  it really  isn't.   The ASCII  macro files  are
  1692.        automatically compiled  and tokenized  on-the-fly when  they have been
  1693.        modified.
  1694.  
  1695.        The main  purpose for  automatically compiling  a  macro  file  is  to
  1696.        resolve which  commands are  macro commands,  and translate  them to a
  1697.        unique  internal   code  (token)  that  allows  the  macro  engine  to
  1698.        immediately know  what the  commands are  when it  executes the  macro
  1699.        file.
  1700.  
  1701.        When a  command is  used that's  not part  of the  macro language, the
  1702.        macro compiler  assumes its  an external  program.  Before making this
  1703.        assumption however,  it scans  the command  against a list of internal
  1704.        MS-DOS commands.   If  the command  matches an internal MS-DOS command
  1705.        (i.e. TIME,  COPY, etc...),  a second copy of COMMAND.COM is used when
  1706.        that macro line is executed.
  1707.  
  1708.        When a  program is  run directly  by the  macro engine,  all forms  of
  1709.        redirection are supported except piping.  If piping is used, the macro
  1710.        engine automatically  uses a  second copy  of COMMAND.COM  to run  the
  1711.        program instead of running the program directly.
  1712.  
  1713.        In the  event that  one of the macro commands happens to coincide with
  1714.        the name  of an external program, and you want the external program to
  1715.        run, not  the macro command - start the macro line with a ">" to force
  1716.        the macro  engine to  use a  second copy  of COMMAND.COM  to  run  the
  1717.        program which  keeps the  macro engine  from mistakenly  executing the
  1718.        internal macro  command.   (Another way to prevent this from happening
  1719.        is to spell out the entire path to the program.)
  1720.  
  1721.        White space (which are space or tab characters) found before a command
  1722.        or after  all of  its parameters  is ignored  for memory conservation.
  1723.        White space  imbedded between  a command  and its  parameters is  also
  1724.        ignored.   The only  time when  this might prove to be a problem is if
  1725.        you use  one of  the ECHO  commands and  want to  display  leading  or
  1726.        trailing spaces.   To work around this, enclose the text within double
  1727.        quotation marks.
  1728.  
  1729.        Comments may  be specified  at any  place in a macro line by using two
  1730.        semicolons in  sequence ("; ;").   When  a comment is encountered, the
  1731.        rest of  the line  is ignored  and consumes  no memory.   White  space
  1732.        leading up to the comment is also ignored.
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.                                           24
  1739.  
  1740.  
  1741.                                                     Macro Language - Overview
  1742.        ----------------------------------------------------------------------
  1743.  
  1744.  
  1745.        If a  comment starts at the beginning of a line, a single semicolon is
  1746.        all that  is needed  to start the comment.  Using two semicolon's will
  1747.        have no adverse affect however.
  1748.  
  1749.        The macro  language is  almost 100% batch file compatible.  You should
  1750.        be able  to directly import most of your existing batch files, precede
  1751.        it with a title line, and then execute it.
  1752.  
  1753.        What  all   this  means  is  that  there's  a  lot  of  sophisiticated
  1754.        intelligence going  on behind  the scene  to make  the macro system as
  1755.        flexible and  easy to  use as  possible,  but  yet  still  keep  it  a
  1756.        responsive 'slick-tight' and efficient runtime environment.
  1757.  
  1758.        A lot  of other  menu systems  and  shells  employ  various  forms  of
  1759.        trickery and  tom-foolery by trying to fool COMMAND.COM with temporary
  1760.        batch files.   In  dCOM's macro system, when you say run this program,
  1761.        dCOM runs that program.  When you say delete these files, dCOM deletes
  1762.        those files.  And its darn quick about doing it....
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.                                           25
  1800.  
  1801.  
  1802.                                                Macro Language - IF Statements
  1803.        ----------------------------------------------------------------------
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.                                    IF StatementsIF Statements
  1810.  
  1811.        IF commands  are expressed  as either  a block-type  structure or as a
  1812.        single line  statement.  If the key word "THEN" is used as the command
  1813.        portion of  an IF statement, it is considered a block-type IF command.
  1814.        If there  is no  command portion  following the  IF expression, it too
  1815.        will be considered a block-type IF structure.
  1816.  
  1817.        The single  line version only executes its command portion when the IF
  1818.        expression is  true.  Execution of the line following a single line IF
  1819.        statement is  not subject  to the IF condition and will always execute
  1820.        unless the IF command jumps around it with a GOTO instruction.
  1821.  
  1822.        Examples of single line IF statements are:
  1823.  
  1824.              IFIF %EL>0 GOTO ERROR
  1825.              IFIF EXIST *.BAK DEL *.BAK
  1826.  
  1827.  
  1828.        Block-type IF  statements allow  multiple  lines  to  execute  if  the
  1829.        expression is  true, or multiple lines to execute if the expression is
  1830.        false (by using an ELSE command).
  1831.  
  1832.        For example:
  1833.  
  1834.              IFIF %EL>0 THENTHEN
  1835.                BEEP
  1836.                ECHO An Error Occurred
  1837.              ELSEELSE
  1838.                ECHO No Error Occurred
  1839.              ENDIFENDIF
  1840.  
  1841.        Within a  block-type IF  structure, an  ELSEIF may  also  be  used  to
  1842.        further the test if the first expression is false.
  1843.  
  1844.        For example:
  1845.  
  1846.              IFIF 2>3 THENTHEN
  1847.                ECHO New Math - Two is Greater Than Three
  1848.              ELSEIFELSEIF 3>2 THENTHEN
  1849.                ECHO Three is Greater Than Two
  1850.              ELSEELSE
  1851.                ECHO No IF Comparisons Are True
  1852.              ENDIFENDIF
  1853.  
  1854.        You can nest block IF statements with no logical limit.  But, for each
  1855.        IF..THEN combination there must be a matching ENDIF.
  1856.  
  1857.  
  1858.  
  1859.  
  1860.                                           26
  1861.  
  1862.  
  1863.                                                Macro Language - IF Statements
  1864.        ----------------------------------------------------------------------
  1865.  
  1866.  
  1867.                                 Compound ExpressionsCompound Expressions
  1868.  
  1869.        IF expressions  can be  joined using .AND. and .OR. logical operators.
  1870.        There is  no limit  on how many .AND. or .OR. operators you can use to
  1871.        tie multiple  IF expressions  together other  than the  macro engine's
  1872.        internal line length limit of 512 characters.
  1873.  
  1874.        When IF  expressions are  tied together  with logical  .AND.  or  .OR.
  1875.        operators, each  individual expression  can fully utilize all possible
  1876.        IF statement options (e.g. EOF(#), ERRORLEVEL, EXIST, NOT, etc...).
  1877.  
  1878.        Spaces used  around .AND.  or .OR. operators are not required, but are
  1879.        recommended to reduce any possible ambiguities.
  1880.  
  1881.        There is  no method  of expressing  a hierarchy to change the order of
  1882.        evaluating  the   expressions  used.    Compound  IF  expressions  are
  1883.        evaluated from  left to right, and the result accumulated from left to
  1884.        right.
  1885.  
  1886.        For example:
  1887.  
  1888.              IFIF 2>3 .OR. 5>6 THENTHEN
  1889.                ECHO Either 2 is greater than 3, or 5 is greater than 6??
  1890.              ELSEIFELSEIF 3>2 .AND. 6>5 THENTHEN
  1891.                ECHO Both 3 is greater than 2, and 6 is greater than 5!!
  1892.              ELSEELSE
  1893.                ECHO No IF Comparisons Are True
  1894.              ENDIFENDIF
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.                                           27
  1922.  
  1923.  
  1924.                                           Macro Language - In-Line Arithmetic
  1925.        ----------------------------------------------------------------------
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.                                  In-Line ArithmeticIn-Line Arithmetic
  1932.  
  1933.        Any macro command that expects a numeric parameter, will recognize the
  1934.        use of  in-line arithmetic  within the  parameter.  Even IF statements
  1935.        will use  in-line arithmetic  if both  operands of  the expression are
  1936.        totally comprised of numeric characters.
  1937.  
  1938.        ,---------------------------------------------------------------------,
  1939.         NOTE: IF  expressions  are  very  sensitive  to  the  use  of  space       |                                                                     |
  1940.               characters.     If  you   use  in-line  arithmetic  in  an  IF       |                                                                     |
  1941.               expression, don't  use space characters between math operators       |                                                                     |
  1942.               or the  IF expression  will probably  improperly determine the       |                                                                     |
  1943.               start of the command portion.       |                                                                     |
  1944.        `---------------------------------------------------------------------'
  1945.  
  1946.        For example,  the CPOSN  command (which  moves  the  cursor)  normally
  1947.        expects  its  arguments  for  the  line  and  column  to  be  numbers.
  1948.        Therefore, you  can use  a statement  like "CPOSN ,%CC+10" and advance
  1949.        the cursor column 10 characters to the right.
  1950.  
  1951.        In-line arithmetic only recognizes the four basic math operators (+, -
  1952.        , *,  and /).   It also correctly handles signed operands (i.e. 2/-3).
  1953.        Multiple operations can be expressed subject only to the internal line
  1954.        limit of the macro engine (i.e. 1+2+3+4).
  1955.  
  1956.        There is  no method  of controlling  the order of evaluation.  In-line
  1957.        math is  always parsed  and accumulated on a left to right basis, with
  1958.        the result of each operation working against that from the one before.
  1959.        Since  there  is  no  method  to  override  the  order  of  evaluation
  1960.        (parenthesis, if  used, will  only cause  parsing to determine nothing
  1961.        numeric is  going on  here), the  normal algebraic rules of performing
  1962.        multiplication and  division before  addition and subtraction are also
  1963.        ignored.
  1964.  
  1965.        Macro commands  which accept  parameters that  can be  either text  or
  1966.        numeric will  not recognize  in-line arithmetic.    It  would  be  too
  1967.        unreliable to try to do so.
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.                                           28
  1983.  
  1984.  
  1985.                                            Macro Language - Menus and Windows
  1986.        ----------------------------------------------------------------------
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.                               Macro Menus and WindowsMacro Menus and Windows
  1993.  
  1994.        A number  of the  macro  commands  display  information  using  pop-up
  1995.        windows:  APPMENU, MENU, QFORMAT, SELECT, WINDOW, etc...
  1996.  
  1997.        When these  commands are  used, if  the macro  key has done nothing to
  1998.        force the  screen to  be cleared  (no ECHO  commands used  or programs
  1999.        run), these  commands will  overlay whatever  is on the screen (except
  2000.        the WINDOW  command which  always clears the screen first if it hasn't
  2001.        been cleared yet).
  2002.  
  2003.        If the  file handler  was active  when the macro is run, the menu will
  2004.        pop-up using  bold colors.  If the menu mode was active and its screen
  2005.        is still  fresh, these  commands will  display using  the menu  mode's
  2006.        colors.   If the screen had been cleared by a preceding macro command,
  2007.        the menu  will display using the current CGA colors dCOM is configured
  2008.        for (if  you are  using the  EGA palette, you will have to temporarily
  2009.        disable it  in the  file handler's  configuration menu to see what the
  2010.        CGA colors  are),  unless  the  menu's  colors  have  been  overridden
  2011.        beforehand with a MENUCOLOR command.
  2012.  
  2013.        All of  the menuing-type  commands  (everything  except  WINDOW),  are
  2014.        mouse-sensitive.   Clicking the  mouse  left  button  on  the  desired
  2015.        selection acts  as if  Return was  pressed on  it.  Clicking the mouse
  2016.        right button  acts as  if Escape  were pressed.  The pop-up menu's are
  2017.        also temporarily moveable by holding the shift key down while using an
  2018.        appropriate arrow key.
  2019.  
  2020.        All of  the menuing-type  commands also have a special memory feature.
  2021.        While the  macro system  is acting  as a menu (either because the menu
  2022.        mode is  active, or  the file  handler's  Backspace  overlay  is  kept
  2023.        alive), if  any of  these menuing-type  commands are re-executed, they
  2024.        will initially start up with the option highlighted that was last used
  2025.        (unless a switch overrides the default option initially selected).
  2026.  
  2027.        Each of  the menuing-type  macro commands recognizes a standard set of
  2028.        switches which  can further customize the menu by doing such things as
  2029.        overriding  where   the  menu  is  displayed,  override  the  starting
  2030.        selection, etc....   These  switches are  described on  the  following
  2031.        page.
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.                                           29
  2044.  
  2045.  
  2046.                                             Macro Language - Menuing Switches
  2047.        ----------------------------------------------------------------------
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.                                   Menuing SwitchesMenuing Switches
  2054.  
  2055.        All of  the menuing-type  macro commands  (APPMENU, MENU, QFORMAT, and
  2056.        SELECT) recognize  a standard set of switches (in addition to any that
  2057.        may be  unique to  a particular  command) which can be used to further
  2058.        customize the menu's appearance.
  2059.  
  2060.        Switches which  are common  to one  or more  of the menuing-type macro
  2061.        commands are  defined here.   Switches that are unique to a particular
  2062.        macro command are defined under that command.
  2063.  
  2064.        /C=lin,col/C=lin,col  Menus are normally displayed centered on the middle of the
  2065.                    screen.   This switch overrides where a menu is physically
  2066.                    displayed  by   centering  it   on  the  line  and  column
  2067.                    coordinates provided  (i.e. /C=10,21).  The menu's display
  2068.                    position will automatically self-adjust in the appropriate
  2069.                    direction if  any portion of the menu would end up off the
  2070.                    screen using the coordinates specified.
  2071.  
  2072.        /E=n/E=n        Overrides the  maximum entries  per column.    Menus  will
  2073.                    normally display  up to  15 entries  in  a  column  before
  2074.                    starting additional  columns.   This switch  allows you to
  2075.                    reduce or expand that number (i.e. /E=10).
  2076.  
  2077.        /F=text/F=text     Overrides  the  default  selection  initially  highlighted
  2078.                    based on  finding the  selection  that  matches  the  text
  2079.                    specified (i.e. /F=Option3).
  2080.  
  2081.        /L=lin,col/L=lin,col  Menus are normally displayed centered on the middle of the
  2082.                    screen.   This switch overrides where a menu is physically
  2083.                    displayed by  locating the  menu's top  left corner on the
  2084.                    line and  column coordinates  provided (i.e. /L=2,3).  The
  2085.                    menu's display  position will automatically self-adjust in
  2086.                    the appropriate direction if any portion of the menu would
  2087.                    end up off the screen using the coordinates specified.
  2088.  
  2089.        /R/R          This switch  causes a menu to remain on the screen after a
  2090.                    selection is  made, with  its window  still saved  on  the
  2091.                    windowing stack.   A  RSTWIN macro command is then used at
  2092.                    some point  later on  to restore the screen and remove the
  2093.                    window, and  also to  restore the  windowing stack.   This
  2094.                    switch allows  menu's to  overlay each other.  Care should
  2095.                    be exercised  though to ensure that a matching RSTWIN will
  2096.                    occur for each menu kept alive with /R, under all possible
  2097.                    paths of macro execution.
  2098.  
  2099.        /S=n/S=n        Overrides  the  default  selection  initially  highlighted
  2100.                    based  on  the  desired  selection's  order  in  the  menu
  2101.                    (i.e. /S=3).
  2102.  
  2103.  
  2104.                                           30
  2105.  
  2106.  
  2107.                                               Macro Language - Macro Commands
  2108.        ----------------------------------------------------------------------
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.                                    Macro CommandsMacro Commands
  2115.  
  2116.          label.............32                MKDIR.............56
  2117.          >command..........32                MENU..............56
  2118.          ADD...............33                MENUCOLOR.........58
  2119.          APPMENU...........33                MENUSTART.........59
  2120.          BEEP..............34                MENUTITLE.........59
  2121.          BROWSE............34                MUL...............60
  2122.          CD................35                ONBREAKGOTO.......60
  2123.          CHDIR.............35                ONERRORGOTO.......61
  2124.          CDD...............35                OPEN..............62
  2125.          CDDO..............35                PATH..............63
  2126.          CLOSE.............35                PATHADD...........63
  2127.          CLS...............36                PATHDEL...........64
  2128.          COLOR.............36                PAUSE.............65
  2129.          CREATE............37                PRINTFIL..........65
  2130.          DEL...............37                PRINTSTR..........65
  2131.          ERASE.............37                PROMPT............66
  2132.          DELAY.............38                QFORMAT...........66
  2133.          DELAYW............38                RD................67
  2134.          DIV...............39                RMDIR.............67
  2135.          DO................39                READ..............67
  2136.          DO WHILE..........40                READB.............67
  2137.          ECHO..............41                READLN............68
  2138.          ECHOC.............41                REBOOT............68
  2139.          ECHOR.............42                RECOMPILE.........69
  2140.          EDIT..............42                REM...............69
  2141.          ELSE..............42                RETURN............69
  2142.          ELSEIF............42                RSTWIN............70
  2143.          ENDDO.............43                RUNMACRO..........70
  2144.          ENDIF.............43                SELECT............70
  2145.          EXIT..............43                SET...............73
  2146.          EXITDCOM..........43                SHIP..............73
  2147.          GET...............44                SUB...............74
  2148.          GETW..............45                VLIST.............74
  2149.          GOSUB.............46                WINDOW............74
  2150.          GOSUBMF...........47                WRITE.............76
  2151.          GOTO..............49                WRITEB............76
  2152.          GOTOMF............49
  2153.          IF................50
  2154.          IF EOF............51
  2155.          IF ERRORLEVEL.....52
  2156.          IF EXIST..........52
  2157.          INCLUDE...........53
  2158.          KEYBOARD..........54
  2159.          KEYWAIT...........54
  2160.          LOOP..............55
  2161.          MACROMENU.........55
  2162.          MD................56
  2163.  
  2164.  
  2165.                                           31
  2166.  
  2167.  
  2168.                                      Macro Language - Macro Command Reference
  2169.        ----------------------------------------------------------------------
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.                               Macro Command ReferenceMacro Command Reference
  2176.  
  2177.  
  2178.        ,---------------------------------------------------------------------,
  2179.          d:d:       |                                                                     |
  2180.        `---------------------------------------------------------------------'
  2181.          Sets a new default drive  (i.e. "A:", or "C:").
  2182.  
  2183.          See also:  %DD, %OD
  2184.  
  2185.  
  2186.        ,---------------------------------------------------------------------,
  2187.          :label:label       |                                                                     |
  2188.        `---------------------------------------------------------------------'
  2189.          Designates a label or comment.
  2190.  
  2191.          Any line beginning with a colon is considered a label.
  2192.  
  2193.          Labels are  used to  specify the  target of  GOSUB, GOTO,  LOOP, and
  2194.          other macro  commands.   Label lines  themselves are  not  executed.
  2195.          When you  enter a  label's text  as part  of a  GOSUB, GOTO, or LOOP
  2196.          command, do  not include  the colon  - just  the text  following the
  2197.          colon.   Labels may  contain imbedded  spaces with no ill effect and
  2198.          are case insensitive.
  2199.  
  2200.          Labels will  be resolved  by the  macro compiler  instead of  during
  2201.          runtime, if  the text  of the  label is  3 characters  or longer and
  2202.          doesn't use  a macro  variable.  The reason why 3 characters is that
  2203.          the compiler  internally replaces  the label  with its resolved line
  2204.          number, and it takes 3 bytes to hold the information.  This can have
  2205.          a significant  impact on  execution speed in large macro definitions
  2206.          by saving  the macro engine from having to search for the label each
  2207.          time a branching instruction is encountered.  Bottom line is, if you
  2208.          can remember,  try and  make the  text of  your labels  at  least  3
  2209.          characters long.
  2210.  
  2211.          This  command   behaves  identically  with  its  MS-DOS  batch  file
  2212.          counterpart.
  2213.  
  2214.          See also:  GOTO, GOSUB, LOOP, ONBREAKGOTO, ONERRORGOTO
  2215.  
  2216.  
  2217.        ,---------------------------------------------------------------------,
  2218.          >command>command       |                                                                     |
  2219.        `---------------------------------------------------------------------'
  2220.          Forces a macro command to be passed to a second copy of COMMAND.COM.
  2221.  
  2222.          Precede macro  lines with  a ">" if a desired program's name happens
  2223.          to coincide  with the  same name as one of the macro commands, or if
  2224.  
  2225.  
  2226.                                           32
  2227.  
  2228.  
  2229.                                      Macro Language - Macro Command Reference
  2230.        ----------------------------------------------------------------------
  2231.  
  2232.  
  2233.          the command  needs to  be processed  by the native command processor
  2234.          (like 4DOS).
  2235.  
  2236.  
  2237.        ,---------------------------------------------------------------------,
  2238.          ADDADD destination,source       |                                                                     |
  2239.        `---------------------------------------------------------------------'
  2240.          Performs a  32-bit  signed  integer  add  operation  using  the  two
  2241.          operands.
  2242.  
  2243.          The destination operand must be a user variable.  The source operand
  2244.          can be a combination of literal text and/or macro variables.
  2245.  
  2246.          The source  operand can  also include  in-line arithmetic,  which is
  2247.          evaluated from  left to  right without regard for standard algebraic
  2248.          order (i.e. multiplication before addition).
  2249.  
  2250.          The result  of the  operation is  returned in  the destination  user
  2251.          variable.
  2252.  
  2253.          See also:  SUB, MUL, DIV
  2254.  
  2255.          Examples:
  2256.  
  2257.              %VAR1=12                ;;%VAR1 = 12
  2258.              %VAR2=23                ;;%VAR2 = 23
  2259.              ADD %VAR1,1             ;;%VAR1 = 13  (12+1)
  2260.              ADD %VAR1,%VAR2         ;;%VAR1 = 36  (13+23)
  2261.              ADD %VAR1,%VAR2+3*2     ;;%VAR1 = 88  (36+((23+3)*2))
  2262.  
  2263.  
  2264.        ,---------------------------------------------------------------------,
  2265.          APPMENUAPPMENU filename       |                                                                     |
  2266.        `---------------------------------------------------------------------'
  2267.          Displays an applications menu.
  2268.  
  2269.          This feature  allows a  menu of different applications (programs) to
  2270.          be quickly  displayed.   The menu is defined by an applications menu
  2271.          text file  found in  dCOM's home  directory.  Applications menu text
  2272.          files must  have a  .APP extension.   This feature is similar to the
  2273.          file handler's  '*'  -  Applications  Menu  command  except  that  a
  2274.          filename must be provided as an argument.
  2275.  
  2276.          If the  menu is cancelled with the Escape key or mouse right button,
  2277.          macro execution aborts unless trapped with ONBREAKGOTO.
  2278.  
  2279.          This command  also recognizes the menuing-type switches described on
  2280.          page 30.
  2281.  
  2282.          The format of an applications menu text file is:
  2283.  
  2284.  
  2285.  
  2286.  
  2287.                                           33
  2288.  
  2289.  
  2290.                                      Macro Language - Macro Command Reference
  2291.        ----------------------------------------------------------------------
  2292.  
  2293.  
  2294.              menutitle
  2295.              menutext,[changepath],[path]program parameters
  2296.              menutext,[changepath],[path]program parameters
  2297.  
  2298.                 *
  2299.                 *
  2300.  
  2301.              menutext,[changepath],[path]program parameters
  2302.  
  2303.          Tabs may be used instead of commas to delimit fields.  Two commas in
  2304.          sequence must be used though if the changepath field is not given.
  2305.  
  2306.          "menutitle" is the text you want displayed as the menu's title.
  2307.  
  2308.          "menutext" is the name for the option that shows in the menu.
  2309.  
  2310.          "changepath" is  the  pathspec  to  change  to  before  running  the
  2311.          program.
  2312.  
  2313.          "program" is  the name  of the  executable program,  followed by its
  2314.          parameters.
  2315.  
  2316.          When an  application is  run from  this menu  the default  drive and
  2317.          current directory  are  saved  before  executing  the  program,  and
  2318.          restored when it exits.
  2319.  
  2320.          See also:  MENUCOLOR
  2321.  
  2322.  
  2323.        ,---------------------------------------------------------------------,
  2324.          BEEPBEEP [ansimusic]       |                                                                     |
  2325.        `---------------------------------------------------------------------'
  2326.          Beeps the speaker
  2327.  
  2328.          This command  is also  capable of  playing ANSI  music.    For  more
  2329.          information refer to the appendix describing ANSI music on page 140.
  2330.  
  2331.  
  2332.        ,---------------------------------------------------------------------,
  2333.          BROWSEBROWSE [d:][path]filename       |                                                                     |
  2334.        `---------------------------------------------------------------------'
  2335.          Provides access to dCOM's text file browser from inside a macro key.
  2336.  
  2337.          When this  command is  used, dCOM  will attempt  to save  the entire
  2338.          screen to  the windowing  stack before  invoking the browser.  If it
  2339.          was successfully  saved, the  entire screen  is  restored  when  the
  2340.          browser exits.
  2341.  
  2342.          See also:  EDIT
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.                                           34
  2349.  
  2350.  
  2351.                                      Macro Language - Macro Command Reference
  2352.        ----------------------------------------------------------------------
  2353.  
  2354.  
  2355.        ,---------------------------------------------------------------------,
  2356.          CDCD [d:]path       |                                                                     |
  2357.          CHDIRCHDIR [d:]path       |                                                                     |
  2358.        `---------------------------------------------------------------------'
  2359.          Changes the current directory.
  2360.  
  2361.          If no drive is given, the default drive is assumed.
  2362.  
  2363.          This command behaves identically with its MS-DOS counterpart.
  2364.  
  2365.          See also:  CDD, CDDO, %CD, %OS
  2366.  
  2367.  
  2368.        ,---------------------------------------------------------------------,
  2369.          CDDCDD [d:][path]       |                                                                     |
  2370.        `---------------------------------------------------------------------'
  2371.          Changes both the default drive and its current directory.
  2372.  
  2373.          This command is provided as a shortcut to having to use two lines to
  2374.          change drives and subdirectories before running a program, etc....
  2375.  
  2376.          See also:  CD, CDDO, %CD, %DD, %OD, %OS
  2377.  
  2378.  
  2379.        ,---------------------------------------------------------------------,
  2380.          CDDOCDDO       |                                                                     |
  2381.        `---------------------------------------------------------------------'
  2382.          Changes back to what was the default drive and its current directory
  2383.          when the macro key was originally executed.
  2384.  
  2385.          Even though the logical use of this command would be on the end of a
  2386.          macro key,  the use of this command is purely optional and can occur
  2387.          more than once as desired.
  2388.  
  2389.          See also:  CD, CDD, %OD, %OS
  2390.  
  2391.  
  2392.        ,---------------------------------------------------------------------,
  2393.          CLOSECLOSE [[#]filenumber]       |                                                                     |
  2394.        `---------------------------------------------------------------------'
  2395.          Closes a  file number, or all open file numbers if no parameters are
  2396.          specified.
  2397.  
  2398.          Files are  opened with  either the  OPEN or  CREATE macro  commands.
  2399.          They are  automatically closed when macro execution terminates, even
  2400.          if they haven't been explicitly closed with this command.
  2401.  
  2402.          See also:  CREATE, OPEN
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.                                           35
  2410.  
  2411.  
  2412.                                      Macro Language - Macro Command Reference
  2413.        ----------------------------------------------------------------------
  2414.  
  2415.  
  2416.          Example:
  2417.  
  2418.              OPEN #1,C:\CONFIG.SYS   ;;OPEN C:\CONFIG.SYS
  2419.              DO WHILE NOT EOF (1)    ;;DO WHILE NOT END OF FILE
  2420.                READLN #1,%TEXT       ;; READ NEXT LINE
  2421.                ECHO %TEXT            ;; DISPLAY IT
  2422.              ENDDO                   ;;END OF DO BLOCK
  2423.              CLOSE #1                ;;CLOSE THE FILE
  2424.  
  2425.  
  2426.        ,---------------------------------------------------------------------,
  2427.          CLSCLS [foreground][,background][,fillchar]       |                                                                     |
  2428.        `---------------------------------------------------------------------'
  2429.          Clears the screen and homes the cursor.
  2430.  
  2431.          If no  colors are  given, the  screen is  cleared using  the  active
  2432.          colors set with a COLOR command.  If no COLOR command is active, the
  2433.          screen is  cleared using  an ANSI instruction if ANSI.SYS is loaded,
  2434.          otherwise a BIOS call is used.
  2435.  
  2436.          The optional  "fillchar" provides a means to clear the screen with a
  2437.          character other  than spaces.  It is specified as an ASCII character
  2438.          code.
  2439.  
  2440.          See also:  COLOR
  2441.  
  2442.          Example:
  2443.  
  2444.              CLS 0,1,176             ;;CLS IN BLACK ON BLUE USING '░'
  2445.  
  2446.  
  2447.        ,---------------------------------------------------------------------,
  2448.          COLORCOLOR [foreground][,background] [/b][/i][/r][/u][/x]       |                                                                     |
  2449.        `---------------------------------------------------------------------'
  2450.          Sets the color used for subsequent CLS and ECHO commands.
  2451.  
  2452.          When a  COLOR command  is  active,  the  macro  engine  uses  dCOM's
  2453.          internal screen  driver to  perform screen  writes.   (The  internal
  2454.          driver is  also used  when a  WINDOW is  open on  the screen.)   The
  2455.          internal screen  driver is  much faster  than using  MS-DOS calls to
  2456.          write to the screen.
  2457.  
  2458.          Using a  COLOR command without any arguments resets the use of color
  2459.          and causes  the macro  engine to  start using  DOS  calls  again  to
  2460.          perform screen writes (as long as a WINDOW isn't active).
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.                                           36
  2471.  
  2472.  
  2473.                                      Macro Language - Macro Command Reference
  2474.        ----------------------------------------------------------------------
  2475.  
  2476.  
  2477.          Optional Switches:
  2478.  
  2479.           /B/B    Sets the blinking attribute.
  2480.  
  2481.           /I/I    Sets the high intensity attribute.
  2482.  
  2483.           /R/R    Reverses the  active colors.   Using  this switch is the only
  2484.                 method to  achieve reverse  video on a monochrome video cards
  2485.                 (color changes are effectively ignored).
  2486.  
  2487.           /U/U    Sets the  underline attribute.   This attribute only works on
  2488.                 monochrome video cards.
  2489.  
  2490.           /X/X    Removes all  attributes.   This switch  is reacted  to  first
  2491.                 before any  other attribute  switches, despite  the order  in
  2492.                 which they might be given.
  2493.  
  2494.          See also:  MENUCOLOR
  2495.  
  2496.          Example:
  2497.  
  2498.              COLOR 1,3               ;;SET ACTIVE COLOR TO BLU ON CYN
  2499.              COLOR 7,0/R             ;;SET WHT ON BLK, AND REVERSE IT
  2500.              COLOR /X/I              ;;RESET ATRIBS, THEN SET INTENSE
  2501.  
  2502.  
  2503.        ,---------------------------------------------------------------------,
  2504.          CREATECREATE [#]filenumber,[d:][path]filename       |                                                                     |
  2505.        `---------------------------------------------------------------------'
  2506.          Creates a file for writing and associates it with a file number.  If
  2507.          the file already exists, its previous contents are erased.
  2508.  
  2509.          Refer to the OPEN command for more details on the file I/O system.
  2510.  
  2511.          See also:  OPEN, WRITE, CLOSE
  2512.  
  2513.          Example:
  2514.  
  2515.              CREATE #1,C:\TEMPDAT.TXT     ;;CREATE C:\TEMPDAT.TXT
  2516.  
  2517.  
  2518.        ,---------------------------------------------------------------------,
  2519.          DELDEL [d:][path]filename [/h][/n][/r][/s][/v]       |                                                                     |
  2520.          ERASEERASE [d:][path]filename [/h][/n][/r][/s][/v]       |                                                                     |
  2521.        `---------------------------------------------------------------------'
  2522.          Deletes files.
  2523.  
  2524.          The filename may include wildcards.
  2525.  
  2526.          For the  most part this command behaves like its MS-DOS counterpart,
  2527.          except that no confirmation prompt is displayed when a "*.*" mask is
  2528.          used.
  2529.  
  2530.  
  2531.                                           37
  2532.  
  2533.  
  2534.                                      Macro Language - Macro Command Reference
  2535.        ----------------------------------------------------------------------
  2536.  
  2537.  
  2538.          Optional Switches:
  2539.  
  2540.           /H/H    Allows files flagged as hidden to be deleted.
  2541.  
  2542.           /N/N    Suppresses any macro error messages like "No Matching files",
  2543.                 or "Access  Denied".  This switch could be used in unattended
  2544.                 modes to  ensure macro  execution will  always continue.   It
  2545.                 also provides  an easy way to do something like "DEL *.BAK/N"
  2546.                 on the tail-end of a macro that runs something which produces
  2547.                 .BAK files,  without having  to worry about doing an IF EXIST
  2548.                 first to avoid error messages if none are found.
  2549.  
  2550.           /R/R    Deletes files  flagged as  read-only instead  of producing an
  2551.                 "Access Denied" error message.
  2552.  
  2553.           /S/S    Allows files with the system attribute to be deleted.
  2554.  
  2555.           /V/V    Causes a verbose display of each file deleted.
  2556.  
  2557.  
  2558.        ,---------------------------------------------------------------------,
  2559.          DELAYDELAY [seconds] [/v]       |                                                                     |
  2560.        `---------------------------------------------------------------------'
  2561.          Causes the  macro to pause for the time period specified in seconds.
  2562.          If the seconds aren't provided, a delay of 1 second will be used.
  2563.  
  2564.          Pressing Escape  or Ctrl-C  while the  delay period  is active  will
  2565.          cause the  macro  to  abort  unless  trapped  with  an  ONBREAKGOTO.
  2566.          Pressing any  other key  will cancel  the delay  countdown and macro
  2567.          execution continues.
  2568.  
  2569.          Optional Switches:
  2570.  
  2571.           /V/V    Causes a verbose display of the delay countdown.
  2572.  
  2573.          See also:  DELAYW
  2574.  
  2575.  
  2576.        ,---------------------------------------------------------------------,
  2577.          DELAYDELAYW [seconds]       |                                                                     |
  2578.        `---------------------------------------------------------------------'
  2579.          This is  a windowized  version of  DELAY. It too causes the macro to
  2580.          pause for  the time  period specified  in seconds.   If  the seconds
  2581.          aren't provided, a delay of 1 second will be used.  But it also pops
  2582.          up a window that displays the countdown, and then removes the window
  2583.          when the countdown is finished.
  2584.  
  2585.          Pressing Escape  or Ctrl-C  while the  delay period  is active  will
  2586.          cause the  macro  to  abort  unless  trapped  with  an  ONBREAKGOTO.
  2587.          Pressing any  other key  will cancel  the delay  countdown and macro
  2588.          execution continues.
  2589.  
  2590.  
  2591.  
  2592.                                           38
  2593.  
  2594.  
  2595.                                      Macro Language - Macro Command Reference
  2596.        ----------------------------------------------------------------------
  2597.  
  2598.  
  2599.          This command  also recognizes the menuing-type switches described on
  2600.          page 30.
  2601.  
  2602.          See also:  DELAY
  2603.  
  2604.  
  2605.        ,---------------------------------------------------------------------,
  2606.          DIVDIV destination,source       |                                                                     |
  2607.        `---------------------------------------------------------------------'
  2608.          Performs a  32-bit signed  integer divide  operation using  the  two
  2609.          operands.
  2610.  
  2611.          The destination operand must be a user variable.  The source operand
  2612.          can be a combination of literal text and/or macro variables.
  2613.  
  2614.          The source  operand can  also include  in-line arithmetic,  which is
  2615.          evaluated from  left to  right without regard for standard algebraic
  2616.          order (i.e. multiplication before addition).
  2617.  
  2618.          The result  of the  operation is  returned in  the destination  user
  2619.          variable.
  2620.  
  2621.          See also:  ADD, SUB, MUL
  2622.  
  2623.          Examples:
  2624.  
  2625.              %VAR1=57                ;;%VAR1 = 57
  2626.              %VAR2=3                 ;;%VAR2 =  3
  2627.              DIV %VAR1,2             ;;%VAR1 = 28  (57/2)
  2628.              DIV %VAR1,%VAR2         ;;%VAR1 =  9  (28/3)
  2629.              DIV %VAR1,%VAR2+4/2     ;;%VAR1 =  3  (9/((3+4)/2))
  2630.  
  2631.  
  2632.        ,---------------------------------------------------------------------,
  2633.          DODO [d:][path]mask [/d][/h]       |                                                                     |
  2634.        `---------------------------------------------------------------------'
  2635.          Repeatedly executes a block of macro lines following the DO command,
  2636.          up to a matching ENDDO, for each occurrence of a file found with the
  2637.          mask specified.
  2638.  
  2639.          Within a  DO block, the %DN and %DE variables are used to access the
  2640.          current   iteration's    filename,   or   filename   and   extension
  2641.          (respectively).   The %DS  variable can  also be  used to access the
  2642.          current iteration's file size.
  2643.  
  2644.          If no  files  qualify  with  the  mask  specified,  execution  jumps
  2645.          immediately around the DO block.
  2646.  
  2647.          Combinations of  DO and DO WHILE blocks are nestable up to 16 levels
  2648.          deep.
  2649.  
  2650.  
  2651.  
  2652.  
  2653.                                           39
  2654.  
  2655.  
  2656.                                      Macro Language - Macro Command Reference
  2657.        ----------------------------------------------------------------------
  2658.  
  2659.  
  2660.          Optional Switches:
  2661.  
  2662.           /D/D    Causes the  DO  command  to  search  for  subdirectory  names
  2663.                 instead of filenames.
  2664.  
  2665.           /H/H    Causes hidden  files (or  subdirectories) to  be included  as
  2666.                 well.
  2667.  
  2668.          See also:  DO WHILE, ENDDO, %DN, %DE, %DS
  2669.  
  2670.          Example:
  2671.  
  2672.              [F1] CONV .ARC TO .ZIP            ;;TITLE LINE AND SWITCHES
  2673.              MD C:\TEMPDIR                     ;;MAKE A TEMPORARY DIRECTORY
  2674.              DODO *.ARC                          ;;START OF DO BLOCK
  2675.                PKUNPAK %DE%DE C:\TEMPDIR          ;; UNARCHIVE CURRENT DO FILE
  2676.                DEL %DE%DE                         ;; DELETE CURRENT DO FILE
  2677.                PKZIP -m %DN%DN C:\TEMPDIR\*.*     ;; REZIP (MOVE) TO DO FILE
  2678.              ENDDOENDDO                             ;;END OF DO BLOCK
  2679.              RD C:\TEMPDIR                     ;;REMOVE TEMPORARY DIRECTORY
  2680.  
  2681.  
  2682.        ,---------------------------------------------------------------------,
  2683.          DO WHILEDO WHILE expression       |                                                                     |
  2684.        `---------------------------------------------------------------------'
  2685.          Repeatedly executes a block of macro lines following the DO command,
  2686.          up to a matching ENDDO, for as long as the expression is true.
  2687.  
  2688.          Any valid  IF construct  can be  used as  the  DO WHILE  expression,
  2689.          including .AND. and .OR. logical operators.
  2690.  
  2691.          If the  expression is  initially false,  execution jumps immediately
  2692.          around the DO WHILE block.
  2693.  
  2694.          Combinations of  DO and DO WHILE blocks are nestable up to 16 levels
  2695.          deep.
  2696.  
  2697.          See also:  DO, ENDDO
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.                                           40
  2715.  
  2716.  
  2717.                                      Macro Language - Macro Command Reference
  2718.        ----------------------------------------------------------------------
  2719.  
  2720.  
  2721.          Examples:
  2722.  
  2723.              OPEN #1,C:\CONFIG.SYS                  ;;OPEN C:\CONFIG.SYS
  2724.              DO WHILE NOT EOF (1)                   ;;WHILE NOT END OF FILE
  2725.                READLN #1,%TEXT                      ;; %TEXT = NEXT LINE
  2726.                ECHO %TEXT                           ;; DISPLAY IT
  2727.              ENDDO                                  ;;END OF DO WHILE BLOCK
  2728.  
  2729.  
  2730.              %COUNT=0                               ;;RESET COUNTER
  2731.              DO WHILE %COUNT<25 .AND. %KB<>%(27)    ;;WHILE CNT<25 AND NO ESC
  2732.                ADD %COUNT,1                         ;; INCREMENT COUNTER
  2733.                ECHO %COUNT                          ;; DISPLAY IT
  2734.              ENDDO                                  ;;END OF DO WHILE BLOCK
  2735.  
  2736.  
  2737.        ,---------------------------------------------------------------------,
  2738.          ECHOECHO ["]text["][;]       |                                                                     |
  2739.        `---------------------------------------------------------------------'
  2740.          Echo's (displays)  text to the screen starting at the current cursor
  2741.          position.
  2742.  
  2743.          A carriage  return and  line feed  are automatically appended to the
  2744.          text unless the text ends with a semi-colon (which isn't displayed).
  2745.  
  2746.          To display leading or trailing spaces, surround the text in optional
  2747.          double quotation marks.
  2748.  
  2749.          The ECHO  command internally  supports redirection  using  the  ">",
  2750.          ">>", and "<" operators.
  2751.  
  2752.          In order  to provide  batch  file  interchangeability,  ECHO ON  and
  2753.          ECHO OFF commands  are ignored.  If you actually want to display the
  2754.          text "ON" or "OFF", enclose the text portion in quotation marks.
  2755.  
  2756.          See also:  COLOR, ECHOC, ECHOR
  2757.  
  2758.  
  2759.        ,---------------------------------------------------------------------,
  2760.          ECHOCECHOC text[;]       |                                                                     |
  2761.        `---------------------------------------------------------------------'
  2762.          Echo's (displays) text to the screen, centered on the current cursor
  2763.          position.
  2764.  
  2765.          ECHOC behaves  the same  as ECHO  except  that  it  doesn't  support
  2766.          redirection
  2767.  
  2768.          The normal  use of  ECHOC is  to first  position the  cursor on  the
  2769.          column where you want the text centered, and then use ECHOC.
  2770.  
  2771.          See also:  COLOR, ECHO, ECHOR
  2772.  
  2773.  
  2774.  
  2775.                                           41
  2776.  
  2777.  
  2778.                                      Macro Language - Macro Command Reference
  2779.        ----------------------------------------------------------------------
  2780.  
  2781.  
  2782.  
  2783.        ,---------------------------------------------------------------------,
  2784.          ECHORECHOR text[;]       |                                                                     |
  2785.        `---------------------------------------------------------------------'
  2786.          Echo's (displays)  text to the screen right justified at the current
  2787.          cursor position.
  2788.  
  2789.          ECHOR behaves  the same  as ECHO  except  that  it  doesn't  support
  2790.          redirection
  2791.  
  2792.          The normal  use of  ECHOR is  to first  position the  cursor on  the
  2793.          column where you want the right-most edge of the text to appear, and
  2794.          then use ECHOR.
  2795.  
  2796.          See also:  COLOR, ECHO, ECHOC
  2797.  
  2798.  
  2799.        ,---------------------------------------------------------------------,
  2800.          EDITEDIT [d:][path]filename       |                                                                     |
  2801.        `---------------------------------------------------------------------'
  2802.          Provides access to dCOM's text editor from inside a macro key.
  2803.  
  2804.          If a  complete path  is not  provided, the editor will resolve it so
  2805.          that the editor can be exited with Alt-Q, directories changed, and a
  2806.          return to  the editor  with a  subsequent save  command won't  loose
  2807.          track of where the file was originally read from.
  2808.  
  2809.          When this  command is  used, dCOM  will attempt  to save  the entire
  2810.          screen to  the windowing  stack before invoking the text editor.  If
  2811.          it was  successfully saved,  the entire  screen is restored when the
  2812.          text editor exits.
  2813.  
  2814.          See also:  BROWSE
  2815.  
  2816.  
  2817.        ,---------------------------------------------------------------------,
  2818.          ELSEELSE       |                                                                     |
  2819.          ELSEIFELSEIF expression [THENTHEN]       |                                                                     |
  2820.        `---------------------------------------------------------------------'
  2821.          Divides an  IF block  into separate  sections.   The  first  section
  2822.          executes if the IF comparison is true, the section following an ELSE
  2823.          statement executes  if the  IF comparison  is false.   If the ELSEIF
  2824.          statement is  used, a second comparison is performed and its section
  2825.          executed, if  the first  IF  expression  is  false  and  the  ELSEIF
  2826.          expression is true.
  2827.  
  2828.          Use of  the keyword THEN is optional.  ELSEIF statements can only be
  2829.          used in  block-type IF constructs and they recognize all options and
  2830.          variations available with an IF statement.
  2831.  
  2832.          For more information refer to IF Statements on page 26.
  2833.  
  2834.  
  2835.  
  2836.                                           42
  2837.  
  2838.  
  2839.                                      Macro Language - Macro Command Reference
  2840.        ----------------------------------------------------------------------
  2841.  
  2842.  
  2843.          See also:  IF, ENDIF
  2844.  
  2845.  
  2846.        ,---------------------------------------------------------------------,
  2847.          ENDDOENDDO       |                                                                     |
  2848.        `---------------------------------------------------------------------'
  2849.          Specifies the end of a DO or DO WHILE block.
  2850.  
  2851.          See also:  DO, DO WHILE
  2852.  
  2853.  
  2854.        ,---------------------------------------------------------------------,
  2855.          ENDIFENDIF       |                                                                     |
  2856.        `---------------------------------------------------------------------'
  2857.          Specifies the end of an IF block.
  2858.  
  2859.          See also:  IF
  2860.  
  2861.  
  2862.        ,---------------------------------------------------------------------,
  2863.          EXITEXIT       |                                                                     |
  2864.        `---------------------------------------------------------------------'
  2865.          Terminates execution of a macro definition.
  2866.  
  2867.  
  2868.        ,---------------------------------------------------------------------,
  2869.          EXITDCOMEXITDCOM [errorlevel] [/n]       |                                                                     |
  2870.        `---------------------------------------------------------------------'
  2871.          Causes dCOM to exit back to the previous process.
  2872.  
  2873.          If no errorlevel is provided, dCOM will exit with an errorlevel of 0
  2874.          (the same  as when  dCOM exits with the file handler's "X" command).
  2875.          Using the  EXITDCOM command  with an  errorlevel allows you to use a
  2876.          batch file to run dCOM and then test on the errorlevel returned when
  2877.          dCOM exits.
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.                                           43
  2898.  
  2899.  
  2900.                                      Macro Language - Macro Command Reference
  2901.        ----------------------------------------------------------------------
  2902.  
  2903.  
  2904.          Optional Switches:
  2905.  
  2906.          /N/N  Suppresses any  error messages  which might  be displayed before
  2907.              actually exiting (i.e. Spooler Not Empty, TSR's Will Be Removed,
  2908.              etc...).   This switch  should be  used if  you  are  using  the
  2909.              EXITDCOM command in conjunction with a KEYBOARD command, because
  2910.              if the  EXITDCOM  command  displays  a  warning  message  before
  2911.              exiting, it  will "eat"  any keystrokes  stuffed in the keyboard
  2912.              queue.
  2913.  
  2914.          Example:
  2915.  
  2916.              [F1] AUTOCAD            ;;TITLE LINE AND SWITCHES
  2917.              EXITDCOM 100            ;;EXIT DCOM WITH ERRORLEVEL 100
  2918.  
  2919.              [F2] HARVARD PROJ MGR   ;;TITLE LINE AND SWITCHES
  2920.              EXITDCOM 101            ;;EXIT DCOM W/NO EXIT PROMPTS
  2921.  
  2922.                 .
  2923.                 .
  2924.  
  2925.              --[DCOM.BAT]----------------------------------------------------
  2926.              :START
  2927.              DCOM /M
  2928.              IF ERRORLEVEL 255 GOTO EXIT
  2929.              IF ERRORLEVEL 101 GOTO HTPM
  2930.              IF ERRORLEVEL 100 GOTO ACAD
  2931.              GOTO EXIT
  2932.              :HTPM
  2933.                C:
  2934.                CD \HTPM
  2935.                HTPM
  2936.                GOTO START
  2937.              :ACAD
  2938.                C:
  2939.                CD \ACAD
  2940.                ACAD
  2941.                GOTO START
  2942.              :EXIT
  2943.  
  2944.          The first  part of  this example  are macro keys that exit dCOM with
  2945.          various error  levels.   The second  part is  a batch file that runs
  2946.          dCOM and then looks for those errorlevels when dCOM exits.  When you
  2947.          test for  errorlevels in  a batch  file,  they  must  be  tested  in
  2948.          descending order.
  2949.  
  2950.  
  2951.        ,---------------------------------------------------------------------,
  2952.          GETGET var[,prompt]       |                                                                     |
  2953.        `---------------------------------------------------------------------'
  2954.          Gets a  response from  the keyboard into a user variable, optionally
  2955.          displaying a prompt first.
  2956.  
  2957.  
  2958.                                           44
  2959.  
  2960.  
  2961.                                      Macro Language - Macro Command Reference
  2962.        ----------------------------------------------------------------------
  2963.  
  2964.  
  2965.          If the  prompt is  cancelled with  the Escape  key, macro  execution
  2966.          aborts unless trapped with ONBREAKGOTO.
  2967.  
  2968.          See also:  GETW
  2969.  
  2970.          Example:
  2971.  
  2972.              [F1] ZIP TAGGED FILES        ;;TITLE LINE AND SWITCHES
  2973.              GETGET %FILE Enter Zip File:    ;;GET .ZIP FILENAME IN %FILE
  2974.              :LABEL1                      ;;LABEL FOR LOOP JUMP
  2975.                ECHO Arcing %TE to %FILE   ;; DISPLAY CURRENT LOOP FILE
  2976.                PKZIP -ex %FILE %TE >NUL   ;; ADD IT TO .ZIP FILE
  2977.              LOOP LABEL1                  ;;LOOP THROUGH TAGGED FILES
  2978.  
  2979.  
  2980.        ,---------------------------------------------------------------------,
  2981.          GETWGETW var,length[,prompt] [/p]       |                                                                     |
  2982.        `---------------------------------------------------------------------'
  2983.          This is  a windowized  version of  GET.  It too gets a response from
  2984.          the keyboard  into a user variable, but it does so inside a box that
  2985.          pops-up in  the center  of the  screen, irrespective  of the current
  2986.          cursor position.
  2987.  
  2988.          The "length" parameter is the editing length you want to provide (so
  2989.          it can build an appropriately sized box).
  2990.  
  2991.          If the  user variable  being edited  already has  a value, the value
  2992.          will initially be displayed as the default value for the prompt.
  2993.  
  2994.          If the  prompt is  cancelled with  the Escape  key, macro  execution
  2995.          aborts unless trapped with ONBREAKGOTO.
  2996.  
  2997.          Optional Switches:
  2998.  
  2999.          /P/P  Invokes the  password mode.   Default  text, or text typed, with
  3000.              this mode  active causes  characters to  be  displayed  as  dots
  3001.              instead of the actual characters.
  3002.  
  3003.          See also:  GET
  3004.  
  3005.          Example:
  3006.  
  3007.              %FILE=TESTFILE.TXT                ;;SET DEFAULT RESPONSE
  3008.              GETWGETW %FILE 10 Enter Filename:     ;;GET A FILENAME IN %FILE
  3009.  
  3010.          Would produce:
  3011.  
  3012.              ,----------------------------,
  3013.              | Enter Filename: _          |
  3014.              `----------------------------'
  3015.  
  3016.  
  3017.  
  3018.  
  3019.                                           45
  3020.  
  3021.  
  3022.                                      Macro Language - Macro Command Reference
  3023.        ----------------------------------------------------------------------
  3024.  
  3025.  
  3026.        ,---------------------------------------------------------------------,
  3027.          GOSUBGOSUB [key:]label       |                                                                     |
  3028.          GOSUBGOSUB [key:]label (p1,p2,p3,...,p9)       |                                                                     |
  3029.        `---------------------------------------------------------------------'
  3030.          Calls a  macro procedure  (subroutine).   This allows  you to define
  3031.          blocks of  macro code  that  function  as  subroutines.    A  RETURN
  3032.          instruction is  used by  the called  procedure to cause execution to
  3033.          return to the line following the GOSUB.
  3034.  
  3035.          Labels within  a macro  definition are considered private.  The same
  3036.          label may  be used again in a different macro definition with no ill
  3037.          effect.   If you wish to call a procedure in a different definition,
  3038.          prefix its  label with  the name  of the  key for  that  definition,
  3039.          separated by a colon (i.e. GOSUB F10:GET_PORT)
  3040.  
  3041.          Labels defined  under a  [PUBLIC] definition however, are accessible
  3042.          by all  macro definitions without having to give a prefix before the
  3043.          label's name.  For more information on [PUBLIC] refer to page 21.
  3044.  
  3045.          This command  also allows  up to nine parameters to be passed to the
  3046.          subroutine being  called.   Inside the subroutine the parameters are
  3047.          available as  %P1..%P9.   The definitions  of %P1..%P9  will  change
  3048.          appropriately for  each nested call to a deeper subroutine, and then
  3049.          return to  what they  were when  the prior level resumes.  if one of
  3050.          the parameters  that needs  to be passed contains a comma or closing
  3051.          parenthesis, surround the parameter in angle brackets to keep either
  3052.          of the  characters  from  terminating  the  parameter  earlier  than
  3053.          desired (i.e. "GOSUB TEST (Names,<Joe,Tom,Dick>)").
  3054.  
  3055.          See also:  GOTO, [PUBLIC], %P1..%P9
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.                                           46
  3081.  
  3082.  
  3083.                                      Macro Language - Macro Command Reference
  3084.        ----------------------------------------------------------------------
  3085.  
  3086.  
  3087.          Example:
  3088.  
  3089.              MAIN MENU                         ;;MENU TITLE
  3090.  
  3091.              [F1] PRINT A FILE                 ;;TITLE LINE AND SWITCHES
  3092.              SELECT *.* Pick a File            ;;DISPLAY MENU OF FILES
  3093.              GOSUBGOSUB GET_PORT                    ;;GET PRINTER PORT IN %PORT
  3094.              PRINTFIL %FE,%PORT                ;;PRINT THE FILE
  3095.  
  3096.                       .
  3097.                       .
  3098.  
  3099.              ;;--- START OF PUBLIC MACRO PROCEDURES -------------------------
  3100.              [PUBLIC]                          ;;START OF PUBLIC SUBROUTINES
  3101.              :GET_PORT                         ;;GET PRINTER PORT IN %PORT
  3102.              MENU Printer Port,Lpt1,Lpt2,Lpt3  ;;DISPLAY MENU OF OPTIONS
  3103.              %PORT=%MT                         ;;%PORT=MENU SELECTION PICKED
  3104.              RETURN                            ;;RETURN TO CALLER
  3105.  
  3106.          In this  example a  procedure called  GET_PORT is  defined under the
  3107.          [PUBLIC] definition.   It  is called  by the  F1 key to let the user
  3108.          select which printer port the file should be printed to.
  3109.  
  3110.  
  3111.        ,---------------------------------------------------------------------,
  3112.          GOSUBMFGOSUBMF [d:][path]macrofile [/key][/c]       |                                                                     |
  3113.          GOSUBMFGOSUBMF [d:][path]macrofile (p1,p2,p3,...,p9) [/key][/c]       |                                                                     |
  3114.        `---------------------------------------------------------------------'
  3115.          Loads a  new macro  file, saving  the current  macro filename on the
  3116.          gosub stack.
  3117.  
  3118.          If the  menu mode  is not active, the function key menu overlay will
  3119.          pop-up as  if Backspace  had been  pressed in  the file handler.  As
  3120.          long as  a gosub'd  macro file  is active,  the  function  key  menu
  3121.          overlay will  continue to reappear after function keys are executed.
  3122.          Pressing Escape  will cancel  the function key overlay menu and also
  3123.          return to  the base  macro file, popping off any gosub'd macro files
  3124.          that may lie in between.
  3125.  
  3126.          If the  menu mode  is active,  pressing Escape  on a  gosub'd  macro
  3127.          file's menu  will perform  an automatic RETURN to the previous macro
  3128.          file.
  3129.  
  3130.          A macro  key executed  from a  gosub'd macro file can itself force a
  3131.          return to the previous macro file by issuing a macro RETURN command.
  3132.  
  3133.          When a  macro file  is returned  to,  execution  of  the  next  line
  3134.          following the GOSUBMF will resume.  The gosub stack can hold approx.
  3135.          9+ nested macro filenames (depending on their length).
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.                                           47
  3142.  
  3143.  
  3144.                                      Macro Language - Macro Command Reference
  3145.        ----------------------------------------------------------------------
  3146.  
  3147.  
  3148.          An optional  path may  be specified prior to the macro filename.  If
  3149.          no path  is specified,  the macro  file is  assumed to be located in
  3150.          dCOM's home directory.
  3151.  
  3152.          If an  optional key (e.g. F1 or sF10) is specified, the macro key(s)
  3153.          are executed  immediately after  the new macro file loads.  Multiple
  3154.          key's can  be given  by preceding  their occurrence(s)  with a  "/".
  3155.          Multiple key's  are executed  in  numerical  order,  not  the  order
  3156.          specified.
  3157.  
  3158.          This command  also allows  up to nine parameters to be passed to the
  3159.          macro file  being called.   Inside the macro file the parameters are
  3160.          available as  %P1..%P9.   The definitions  of %P1..%P9  will  change
  3161.          appropriately for  each nested call to a deeper subroutine, and then
  3162.          return to  what they  were when  the prior level resumes.  if one of
  3163.          the parameters  that needs  to be passed contains a comma or closing
  3164.          parenthesis, surround the parameter in angle brackets to keep either
  3165.          of the  characters  from  terminating  the  parameter  earlier  than
  3166.          desired (i.e. "GOSUBMF UTILS.MAC (Names,<Joe,Tom,Dick>)").
  3167.  
  3168.          Using GOSUBMF  is the  key to  building layered  menuing structures.
  3169.          Refer to Menuing on page 119 for more information.
  3170.  
  3171.          Optional Switches:
  3172.  
  3173.           /C/C    Causes the  gosub'd macro  menu to  display cascaded  a level
  3174.                 deeper than  the previous  menu, allowing  the title  of  the
  3175.                 previous macro  file to  remain visible  behind the new macro
  3176.                 menu.   Multiple levels  of cascading may be used for as much
  3177.                 room remains  on the  screen.   If more than three levels are
  3178.                 used, a MENUSTART command (in a [MENUAUTO] definition) may be
  3179.                 needed to  shift the  start of the displayed menu's higher on
  3180.                 the screen.
  3181.  
  3182.          See also:  GOTOMF, RETURN, %P1..%P9
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.                                           48
  3203.  
  3204.  
  3205.                                      Macro Language - Macro Command Reference
  3206.        ----------------------------------------------------------------------
  3207.  
  3208.  
  3209.          Example:
  3210.  
  3211.              MAIN MENU               ;;MENU TITLE
  3212.  
  3213.              [F1] FORMAT DISK MENU   ;;TITLE LINE AND SWITCHES
  3214.              GOSUBMFGOSUBMF FORMAT /C       ;;CALL FORMAT MACRO FILE
  3215.  
  3216.              [F2] WORD PROC MENU     ;;TITLE LINE AND SWITCHES
  3217.              GOSUBMFGOSUBMF WORDPROC /C     ;;CALL WORDPROC MACRO FILE
  3218.  
  3219.              [F3] UTILITY MENU       ;;TITLE LINE AND SWITCHES
  3220.              GOSUBMFGOSUBMF UTILITYS /C     ;;CALL UTILITYS MACRO FILE
  3221.  
  3222.                       *
  3223.                       *
  3224.  
  3225.              [F10] RET TO MAIN MENU  ;;TITLE LINE AND SWITCHES
  3226.              RETURNRETURN                  ;;RETURN TO PREVIOUS MACRO FILE
  3227.  
  3228.          This example  provides options to call FORMAT.MAC, WORDPROC.MAC, and
  3229.          UTILITYS.MAC, and an option to return to the previous macro file.
  3230.  
  3231.  
  3232.        ,---------------------------------------------------------------------,
  3233.          GOTOGOTO [key:]label       |                                                                     |
  3234.        `---------------------------------------------------------------------'
  3235.          Jumps unconditionally to the label specified.
  3236.  
  3237.          Labels within  a macro key are considered local.  The same label may
  3238.          be defined  again in  a different  macro key with no ill effect.  If
  3239.          you wish  to jump  to a  label in  a different macro key, prefix the
  3240.          label with the name of that key, separated by a colon.
  3241.  
  3242.          See also:  GOSUB, ONBREAKGOTO, ONERRORGOTO
  3243.  
  3244.  
  3245.        ,---------------------------------------------------------------------,
  3246.          GOTOMFGOTOMF [d:][path]macrofile [/key]       |                                                                     |
  3247.        `---------------------------------------------------------------------'
  3248.          Specifies and  loads a  new active  macro file but does not save any
  3249.          return information.
  3250.  
  3251.          An optional  path may  be specified prior to the macro filename.  If
  3252.          no path  is specified,  the macro  file is  assumed to be located in
  3253.          dCOM's home directory.
  3254.  
  3255.          If the  optional key  (e.g. F1  or  SF10)  is  also  specified,  the
  3256.          specified macro  key(s) are executed immediately after the new macro
  3257.          file loads.    Multiple  key's  can  be  given  by  preceding  their
  3258.          occurrence(s) with  a "/".  Multiple key's are executed in numerical
  3259.          order, not the order specified.
  3260.  
  3261.  
  3262.  
  3263.                                           49
  3264.  
  3265.  
  3266.                                      Macro Language - Macro Command Reference
  3267.        ----------------------------------------------------------------------
  3268.  
  3269.  
  3270.          See also:  GOSUBMF
  3271.  
  3272.  
  3273.        ,---------------------------------------------------------------------,
  3274.          IFIF [NOT] operand1 <=> operand2 command       |                                                                     |
  3275.          IFIF [NOT] operand1 <=> operand2 [THENTHEN]       |                                                                     |
  3276.        `---------------------------------------------------------------------'
  3277.          Executes a  command or  block of  commands  if  the  result  of  the
  3278.          expression is true.
  3279.  
  3280.          If Operand2  contains embedded spaces, it must be enclosed in double
  3281.          quotation marks.  Spaces are used to delimit the second operand from
  3282.          the command  that follows.   If  Operand2 is enclosed in quotes, the
  3283.          quotes are  removed before the comparison is performed.  Do not also
  3284.          follow suite  and enclose  Operand1 in  quotes.   Operand1 does  not
  3285.          automatically strip  out quotation  marks and they would be included
  3286.          as part of the comparison.
  3287.  
  3288.          If you  are using an IF command with relational operators ("<", "=",
  3289.          or ">"),  at least  one must  be specified, but more than one can be
  3290.          used.
  3291.  
  3292.          If both  operands are comprised totally of numeric characters (0..9,
  3293.          "+", "-",  "*", or "/"), a 32-bit signed comparison is performed and
  3294.          in-line arithmetic can be used (i.e. IF 3+4>6 THEN).
  3295.  
  3296.          When operands are not numeric, the comparison is not case sensitive.
  3297.          If operand1  is shorter  than operand2  but equal  to it for as many
  3298.          characters as it contains, it will be considered less than operand2.
  3299.  
  3300.          If date  variables are  being used  as the  operands, both  operands
  3301.          should be  equally quoted  in something  other than double quotation
  3302.          marks (any  character will  do) to  force a  text-based  comparison.
  3303.          Otherwise, they  will look  like numeric  expressions using  in-line
  3304.          arithmetic (i.e.  06-27-91 =  -112, or 06/27/91 = 0) and the numeric
  3305.          results will be the determining factor of the comparison.
  3306.  
  3307.          For more information refer to IF Statements on page 26.
  3308.  
  3309.          See also:  ELSE, ELSEIF, ENDIF
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.                                           50
  3325.  
  3326.  
  3327.                                      Macro Language - Macro Command Reference
  3328.        ----------------------------------------------------------------------
  3329.  
  3330.  
  3331.          Examples:
  3332.  
  3333.              [F1] CHKDSK /w                    ;;TITLE LINE AND SWITCHES
  3334.              CHKDSK C:                         ;;CHECK DRIVE C: INTEGRITY
  3335.              IFIF %EL>0 THENTHEN                     ;;IF ERRORLEVEL GREATER THAN 0
  3336.                BEEP                            ;; BEEP
  3337.                ECHO Errors Found on Drive C:!  ;; ECHO ERRORS FOUND
  3338.              ELSEELSE                              ;;ELSE
  3339.                ECHO Drive C: Has No Errors     ;; ECHO NO ERRORS
  3340.              ENDIFENDIF                             ;;END OF IF BLOCK
  3341.  
  3342.              [F1] FORMAT A:                    ;;TITLE LINE AND SWITCHES
  3343.              BEEP                              ;;BEEP SPEAKER
  3344.              MENU Are You Sure?,Yup,Heck No    ;;ASK FOR PERMISSION
  3345.              IFIF %MT="YUP" FORMAT A:            ;;IF ANSWER WAS YES, DO IT
  3346.  
  3347.  
  3348.        ,---------------------------------------------------------------------,
  3349.          IFIF [NOT] EOFEOF [#]filenumber       |                                                                     |
  3350.          IFIF [NOT] EOFEOF [#]filenumber [THENTHEN]       |                                                                     |
  3351.        `---------------------------------------------------------------------'
  3352.          Executes a  command or  block of  commands depending  on whether the
  3353.          specified file number is at the end of file.
  3354.  
  3355.          The file  number must  previously have  been opened  with an OPEN or
  3356.          CREATE command.   The  file number  can be expressed with or without
  3357.          the pound  symbol ("#"),  and  it  can  optionally  be  enclosed  in
  3358.          parenthesis, depending on preference.
  3359.  
  3360.          For more information refer to IF Statements on page 26.
  3361.  
  3362.          See also:  ELSE, ELSEIF, ENDIF
  3363.  
  3364.          Example:
  3365.  
  3366.              OPEN #1,C:\AUTOEXEC.BAT ;;OPEN THE AUTOEXEC.BAT FILE
  3367.              :LABEL1                 ;;JUMP POINT FOR READING
  3368.              IF NOT EOF (#1) THEN    ;;IF NOT END OF FILE
  3369.                READLN #1,%TEXT       ;; %TEXT=NEXT LINE
  3370.                ECHO %TEXT            ;; DISPLAY IT
  3371.                GOTO LABEL1           ;; LOOP BACK FOR NEXT LINE
  3372.              ENDIF                   ;;END OF IF BLOCK
  3373.  
  3374.          Note:  This  particular   example  could   have  been  written  more
  3375.          efficiently using a DO WHILE NOT EOF loop instead of IF NOT EOF.
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.                                           51
  3386.  
  3387.  
  3388.                                      Macro Language - Macro Command Reference
  3389.        ----------------------------------------------------------------------
  3390.  
  3391.  
  3392.        ,---------------------------------------------------------------------,
  3393.          IFIF [NOT] ERRORLEVEL nERRORLEVEL n command       |                                                                     |
  3394.          IFIF [NOT] ERRORLEVEL n ERRORLEVEL n [THENTHEN]       |                                                                     |
  3395.        `---------------------------------------------------------------------'
  3396.          This variation  of  the  IF  command  is  provided  for  batch  file
  3397.          compatibility.
  3398.  
  3399.          The IF  condition is  true if  the last program executed returned an
  3400.          error level equal to or greater than value n.
  3401.  
  3402.          The same  test can  be performed in a more readable manner using the
  3403.          %EL macro variable (i.e.  IF  %EL>0  GOTO  ERROR).
  3404.  
  3405.          See also:  ELSE, ELSEIF, ENDIF, %EL
  3406.  
  3407.          Example:
  3408.  
  3409.              [F1] COMPILE FILE /w         ;;TITLE LINE AND SWITCHES
  3410.              MASM %FN,,%FN;               ;;COMPILE SELECTED FILE
  3411.              IF ERRORLEVELIF ERRORLEVEL 1 GOTO ERROR   ;;IF ERROR GOTO ERROR
  3412.              LINK %FN;                    ;;LINK THE PROGRAM
  3413.              IF ERRORLEVELIF ERRORLEVEL 1 GOTO ERROR   ;;IF ERROR GOTO ERROR
  3414.              DEL %FN.OBJ                  ;;DELETE THE .OBJ FILE
  3415.              EXIT                         ;;EXIT THE MACRO KEY
  3416.              :ERROR                       ;;LABEL FOR GOTO ERROR
  3417.              BEEP                         ;;BEEP THE SPEAKER
  3418.  
  3419.  
  3420.        ,---------------------------------------------------------------------,
  3421.          IFIF [NOT] EXISTEXIST [path]filename command       |                                                                     |
  3422.          IFIF [NOT] EXISTEXIST [path]filename [THENTHEN]       |                                                                     |
  3423.        `---------------------------------------------------------------------'
  3424.          Executes a  command or  block  of  commands  based  on  whether  the
  3425.          specified file exists (or does NOT exist).
  3426.  
  3427.          The filename  specified may  include wildcards  or a  subdirectory's
  3428.          name.   An exist  test will  test true  if the  file has a hidden or
  3429.          system flag set.
  3430.  
  3431.          You can  also use  this command to test on whether a drive exists by
  3432.          testing against "d:\NUL".
  3433.  
  3434.          For more information refer to IF Statements on page 26.
  3435.  
  3436.          See also:  ELSE, ELSEIF, ENDIF
  3437.  
  3438.  
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.                                           52
  3447.  
  3448.  
  3449.                                      Macro Language - Macro Command Reference
  3450.        ----------------------------------------------------------------------
  3451.  
  3452.  
  3453.          Example:
  3454.  
  3455.              [F1] MOVE .BAK FILES    ;;TITLE LINE AND SWITCHES
  3456.              IF EXISTIF EXIST *.BAK THENTHEN     ;;IF THERE ARE ANY .BAK FILES
  3457.                COPY *.BAK D:\BACKUP  ;; THEN COPY THEM TO D:\BACKUP
  3458.                DEL *.BAK             ;; AND THEN DELETE THEM
  3459.              ENDIFENDIF                   ;;END OF IF BLOCK
  3460.  
  3461.  
  3462.        ,---------------------------------------------------------------------,
  3463.          INCLUDEINCLUDE [d:][path]filename       |                                                                     |
  3464.        `---------------------------------------------------------------------'
  3465.          Includes another text file as part of the current macro file.
  3466.  
  3467.          Include files are useful for holding commonly used subroutines under
  3468.          a [PUBLIC]  definition, that more than one macro file might want  to
  3469.          access.   Or, for  setting global static variables under a [EQUATES]
  3470.          definition.
  3471.  
  3472.          An optional path may be specified prior to the include filename.  If
  3473.          no path  is specified,  the include file is assumed to be located in
  3474.          dCOM's home  directory.   No default  extension is  assumed with the
  3475.          include filename.
  3476.  
  3477.          INCLUDE files  can be nested up to 16 levels deep.  The total number
  3478.          of INCLUDE  commands that  may be  invoked by  a macro  file and its
  3479.          included files is 255.
  3480.  
  3481.          Unlike almost  all other  macro commands,  the  INCLUDE  command  is
  3482.          handled by  the internal  compiler -  not by the macro engine during
  3483.          runtime.   Compiled macro files (the hidden .CMF files), contain the
  3484.          effects of included files when they are written by the compiler.
  3485.  
  3486.          If a  file I/O  error occurs  while the macro compiler is opening or
  3487.          reading an  include file,  a real-time error is displayed indicating
  3488.          the problem.   After  which, the  include file  is abandoned and the
  3489.          macro compiler  continues compiling the macro code that attempted to
  3490.          call the  include file.  The error message will only occur just once
  3491.          until the  next time  the macro  system thinks it needs to recompile
  3492.          that macro file.
  3493.  
  3494.          An INCLUDE  command can  occur as  the first  significant line  of a
  3495.          macro file,  which is  normally reserved for the macro's menu title.
  3496.          In this  case, the  macro compiler will internally flag the title as
  3497.          having been  set, even  though it  actually hasn't.  The macro title
  3498.          can still  be set  though by  using a  subsequent MENUTITLE command.
  3499.          INCLUDE and  MENUTITLE are the only commands recognizable before the
  3500.          first macro definition starts in a macro file.
  3501.  
  3502.          For more information refer to Include Files on page 123.
  3503.  
  3504.          See also:  MENUTITLE
  3505.  
  3506.  
  3507.                                           53
  3508.  
  3509.  
  3510.                                      Macro Language - Macro Command Reference
  3511.        ----------------------------------------------------------------------
  3512.  
  3513.  
  3514.          Example:
  3515.  
  3516.              INCLUDE MYPROCS.INC     ;;INCLUDE MYPROCS.INC FILE
  3517.  
  3518.  
  3519.        ,---------------------------------------------------------------------,
  3520.          KEYBOARDKEYBOARD text       |                                                                     |
  3521.        `---------------------------------------------------------------------'
  3522.          Stuffs the keyboard type-ahead queue with text.
  3523.  
  3524.          This command  is provided as a simple 'down-n-dirty' method to stuff
  3525.          ASCII characters  in the  keyboard queue.  It doesn't bother to also
  3526.          include scan codes which, might be needed by some applications.
  3527.  
  3528.          The maximum  length of  the text is 15 characters (which is the size
  3529.          of the  BIOS keyboard  queue).   Also, a Return is not automatically
  3530.          installed after  the text.   If  you need one, append a %(13) to the
  3531.          text used.
  3532.  
  3533.          Example:
  3534.  
  3535.              [F1] HARVARD PROJ MGR        ;;TITLE LINE AND SWITCHES
  3536.              KEYBOARD C:\BAT\HTPM%(13)    ;;STUFF KEYBRD W/WHAT TO DO NEXT
  3537.              EXITDCOM /n                  ;;EXIT DCOM W/NO EXIT PROMPTS
  3538.  
  3539.          This example  stuffs "C:\BAT\HTPM<RET>"  in the  keyboard queue  and
  3540.          then exits  dCOM.   It assumes  there's a  batch file  in  directory
  3541.          C:\BAT called HTPM.BAT, which runs Harvard Project Manager and would
  3542.          then rerun  dCOM  again  when  its  finished.    This  works  ok  if
  3543.          COMMAND.COM ran  dCOM.   If dCOM  was loaded as the primary shell in
  3544.          CONFIG.SYS, there's  nothing to  exit to,  and the  EXITDCOM command
  3545.          will fail.
  3546.  
  3547.  
  3548.        ,---------------------------------------------------------------------,
  3549.          KEYWAITKEYWAIT       |                                                                     |
  3550.        `---------------------------------------------------------------------'
  3551.          Pauses macro  execution and  waits for  any keyboard character to be
  3552.          pressed.
  3553.  
  3554.          Unlike the  PAUSE command,  this command  does not disturb the video
  3555.          display.
  3556.  
  3557.          KEYWAIT is mouse sensitive.  Pressing the left mouse button will act
  3558.          as if the Return key was pressed.  The right button as if Escape was
  3559.          pressed.
  3560.  
  3561.          You can  check which  key was  pressed afterwards by testing the %EL
  3562.          system variable.   If   %EL  is greater  than 255,  a non-alpha  key
  3563.          (function keys,  cursor keys, etc...) was pressed.  If %EL is 255 or
  3564.          less, it  will contain  the key's  ASCII value (i.e. "A"=65, "B"=66,
  3565.          etc...).  If the Return key was pressed, %EL will equal 13.
  3566.  
  3567.  
  3568.                                           54
  3569.  
  3570.  
  3571.                                      Macro Language - Macro Command Reference
  3572.        ----------------------------------------------------------------------
  3573.  
  3574.  
  3575.          If the  Escape key is pressed, the macro key aborts execution unless
  3576.          trapped with ONBREAKGOTO.
  3577.  
  3578.          See also:  PAUSE
  3579.  
  3580.  
  3581.        ,---------------------------------------------------------------------,
  3582.          LOOPLOOP label       |                                                                     |
  3583.        `---------------------------------------------------------------------'
  3584.          Loops back  to the  label specified  for each occurrence of a tagged
  3585.          file.
  3586.  
  3587.          Within a  LOOP block,  the %TN  and %TE variables are used to access
  3588.          the  current   iteration's  filename,   or  filename  and  extension
  3589.          (respectively).
  3590.  
  3591.          If no  files are  tagged, the  %TN or  %TE variables will return the
  3592.          currently selected  filename (or  filename and  extension), and  the
  3593.          LOOP command will execute for only one iteration.
  3594.  
  3595.          If your  macro absolutely  wants tagged  files, test on the value of
  3596.          %TC before entering the loop block.
  3597.  
  3598.          Example:
  3599.  
  3600.              [F1] ARCHIVE TAGGED /W       ;;TITLE LINE AND SWITCHES
  3601.              IF %TC%TC < 1 THEN              ;;IF THERE ARE NO TAGGED FILES
  3602.                BEEP                       ;; THEN BEEP THE SPEAKER
  3603.                MENU Tagged Files Required ;; USE MENU COMMAND TO
  3604.                 .Press Return to Continue ;;   DISPLAY ERROR
  3605.                EXIT                       ;; TERMINATE THE MACRO KEY
  3606.              ENDIF                        ;;END OF IF BLOCK
  3607.              GET %FILE Enter Zip File:    ;;GET A FILENAME IN %FILE
  3608.              :LABEL1:LABEL1                      ;;START OF LOOP BLOCK
  3609.                ECHO Zipping %TE%TE to %FILE  ;; DISPLAY CURRENT LOOP FILE
  3610.                PKZIP %FILE %TE%TE >NUL       ;; ADD IT TO .ZIP FILE
  3611.              LOOP LABEL1LOOP LABEL1                  ;;LOOP THROUGH TAGGED FILES
  3612.  
  3613.  
  3614.        ,---------------------------------------------------------------------,
  3615.          MACROMENUMACROMENU ON|OFF       |                                                                     |
  3616.        `---------------------------------------------------------------------'
  3617.          If the  menu mode is active, a MACROMENU OFF command will deactivate
  3618.          (suspend) the menu mode, causing control to drop to the file handler
  3619.          when macro execution terminates.
  3620.  
  3621.          If the  menu mode  is active  but has been suspended, a MACROMENU ON
  3622.          will reactivate the menu mode when macro execution terminates.
  3623.  
  3624.          If the menu mode is not active (dCOM's /M command line switch wasn't
  3625.          specified at  start up),  a  MACROMENU ON  command  will  cause  the
  3626.          function key  overlay to  appear when macro execution terminates (as
  3627.  
  3628.  
  3629.                                           55
  3630.  
  3631.  
  3632.                                      Macro Language - Macro Command Reference
  3633.        ----------------------------------------------------------------------
  3634.  
  3635.  
  3636.          if Backspace  were pressed  in the file handler).  When the function
  3637.          key overlay  menu is  activated in  this manner, it becomes "sticky"
  3638.          about wanting  to stay  active.   It will continue to reappear after
  3639.          macro keys  are executed  until it  is explicitly escaped.  Normally
  3640.          however, when  the function  key  overlay  menu  is  activated  with
  3641.          Backspace it  will not  reappear after  one of  the  macro  keys  is
  3642.          executed unless  the macro  key gosubs  another macro file.  In this
  3643.          case, the function key overlay will continue to reappear after macro
  3644.          keys are executed as long as a macro file is gosub'd.
  3645.  
  3646.          Using this command in either fashion is not normally required.
  3647.  
  3648.          See also:  %MM
  3649.  
  3650.  
  3651.        ,---------------------------------------------------------------------,
  3652.          MDMD [d:][path]dirname       |                                                                     |
  3653.          MKDIRMKDIR [d:][path]dirname       |                                                                     |
  3654.        `---------------------------------------------------------------------'
  3655.          Makes a new subdirectory.
  3656.  
  3657.          This macro  command  is  functionally  equivalent  with  its  MS-DOS
  3658.          counterpart except that it can make more than one new directory in a
  3659.          given path simultaneously.  For instance, if C:\DOCS did not already
  3660.          exist as  a subdirectory,  when  a  MD C:\DOCS\REPORTS  command  was
  3661.          encountered, dCOM would build both directories without an error, but
  3662.          MS-DOS would 'choke'.
  3663.  
  3664.          See also:  RD
  3665.  
  3666.  
  3667.        ,---------------------------------------------------------------------,
  3668.          MENUMENU [title],sel1,sel2[,sel3][,sel4...]       |                                                                     |
  3669.        `---------------------------------------------------------------------'
  3670.          Displays a  user designed  pop-up menu.  This command lets you build
  3671.          your own  point-n-shoot, mouse-sensitive  menus.  The results of the
  3672.          option selected  can then be accessed in following macro lines using
  3673.          the %MT  and %MS  system variables.   %MT  returns the  text of  the
  3674.          option selected.   %MS returns a numerical value indicating the line
  3675.          number selected (1=1st, 2=2nd...).
  3676.  
  3677.          The first parameter expected is the menu's title.  The title is then
  3678.          followed by  the options  you wish displayed, separated with commas.
  3679.          If no  title is  used, the  first selection  must be preceded with a
  3680.          comma.
  3681.  
  3682.          MENU commands  also recognize  the use  of continuation lines.  This
  3683.          may be  necessary to  avoid overrunning  the macro engine's internal
  3684.          line length  of 512 characters, or just to express the macro code in
  3685.          a manner  more representative  of the  actual menu.   Any macro line
  3686.          following a  MENU command  whose first  significant character begins
  3687.          with a  period is  considered a  continuation line.  If continuation
  3688.  
  3689.  
  3690.                                           56
  3691.  
  3692.  
  3693.                                      Macro Language - Macro Command Reference
  3694.        ----------------------------------------------------------------------
  3695.  
  3696.  
  3697.          lines are  used, it is not necessary to terminate the preceding line
  3698.          with a trailing comma.
  3699.  
  3700.          If the  menu is cancelled with the Escape key or mouse right button,
  3701.          macro execution  aborts unless  trapped with  ONBREAKGOTO.  Refer to
  3702.          the ONBREAKGOTO command for an example of how to trap the Escape key
  3703.          and build submenus.
  3704.  
  3705.          This command  also recognizes the menuing-type switches described on
  3706.          page 30.
  3707.  
  3708.          See also:  MENUCOLOR, SELECT, %MS, %MT
  3709.  
  3710.          Examples:
  3711.  
  3712.              [F1] FORMAT             ;;TITLE LINE AND SWITCHES
  3713.              MENU FORMAT,A:,B:       ;;DISPLAY FORMAT DRIVE OPTIONS
  3714.              %DRIVE=%MT              ;;SAVE IT IN %DRIVE
  3715.              MENU FORMAT %DRIVE      ;;DISPLAY THE
  3716.               .360K                  ;; FORMAT /F: OPTIONS
  3717.               .720K                  ;; USING A MENU COMMAND
  3718.               .1.2M                  ;; WITH CONTINUATION LINES
  3719.               .1.44M                 ;;DISPLAY FORMAT /F: OPTIONS
  3720.              FORMAT %DRIVE /F:%MT    ;;RUN FORMAT WITH SELECTIONS
  3721.  
  3722.              [F1] FORMAT A:          ;;TITLE LINE AND SWITCHES
  3723.              BEEP                    ;;BEEP SPEAKER
  3724.              MENU Are You Sure?,Yes,No    ;;ASK FOR PERMISSION
  3725.              IF %MS=1 FORMAT A:      ;;IF ANSWER WAS YES, DO IT
  3726.  
  3727.          The MENU command also has another feature designed primarily for use
  3728.          on a  network, which  allows individual  entries in  the menu  to be
  3729.          conditional upon  whether an  exist test  for a file or directory is
  3730.          true for  the current user.  If the exist test fails, the user won't
  3731.          see the  particular option.   Conditional menu options are expressed
  3732.          by separating the menu text from the exist test with a semicolon (or
  3733.          tab).
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.                                           57
  3752.  
  3753.  
  3754.                                      Macro Language - Macro Command Reference
  3755.        ----------------------------------------------------------------------
  3756.  
  3757.  
  3758.          For example:
  3759.  
  3760.              [F1] APPLICATIONS            ;;TITLE LINE AND SWITCHES
  3761.              MENU APPLICATIONS            ;;MENU COMMAND AND ITS TITLE
  3762.               .WORDSTAR;F:\WS6LAN\WS.EXE  ;; CONDITIONAL 1ST OPTION
  3763.               .HARVARD;F:\HG\HG.EXE       ;; CONDITIONAL 2ND OPTION
  3764.              GOTO %MT                     ;;GOTO OPTION PICKED
  3765.              :WORDSTAR                    ;;WORDSTAR OPTION
  3766.                CDD F:\WS6LAN              ;; CHANGE DRIVE AND DIRECTORIES
  3767.                WS                         ;; RUN WORDSTAR
  3768.                CDDO                       ;; RETURN TO ORIG DRIVE & DIR
  3769.                EXIT                       ;; AND TERMINATE MACRO
  3770.              :HARVARD                     ;;HARVARD OPTION
  3771.                CDD F:\HG                  ;; CHANGE DRIVE AND DIRECTORIES
  3772.                HG                         ;; RUN HARVARD GRAPHICS
  3773.                CDDO                       ;; RETURN TO ORIG DRIVE & DIR
  3774.                EXIT                       ;; AND TERMINATE MACRO
  3775.  
  3776.          This example  only displays  the Wordstar and Harvard options if the
  3777.          user has  sufficient privileges  to see  their executable files.  If
  3778.          you are  using NetWare  3.0 or  greater, the  exist  path  could  be
  3779.          shortened down to just the directory name itself because users can't
  3780.          see a  subdirectory name at all if they don't have any privileges in
  3781.          it.
  3782.  
  3783.          Note that  the %MT system variable is used to determine which option
  3784.          was picked (GOTO %MT).  When you are using conditional menu options,
  3785.          the number  of the  selection picked  can vary between users, making
  3786.          the %MS variable unreliable.
  3787.  
  3788.          Also, the macro code depicted that actually runs the applications is
  3789.          probably nowhere  near as  comprehensive as it would normally be for
  3790.          network use.
  3791.  
  3792.  
  3793.        ,---------------------------------------------------------------------,
  3794.          MENUCOLORMENUCOLOR fc,bc,blc,hc[,bt]       |                                                                     |
  3795.        `---------------------------------------------------------------------'
  3796.          Overrides the  default colors  used by  any subsequent  menuing-type
  3797.          command.   This command  also overrides the menu mode's function key
  3798.          menu colors if used in a [MENUAUTO] definition.
  3799.  
  3800.          If a  MENUCOLOR command  is executed  when the  EGA palette is still
  3801.          remapped to non-CGA colors, an automatic clear screen will be issued
  3802.          to restore the EGA palette back to normal.
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.                                           58
  3813.  
  3814.  
  3815.                                      Macro Language - Macro Command Reference
  3816.        ----------------------------------------------------------------------
  3817.  
  3818.  
  3819.          fc  fc  The menu selection text foreground color (0..15)
  3820.          bc  bc  The menu background color (0..7)
  3821.          blc blc The foreground color of the border lines (0..15)
  3822.          hc  hc  The foreground color of the header text (0..15)
  3823.          bt  bt  An optional  border  line-type  override  (1..4).    1 = single-
  3824.              width lines,      2 = double-width lines,       3 = solid lines,
  3825.              4 = no border lines.   If this value isn't specified, menus will
  3826.              use whatever line type the file handler is configured for.
  3827.  
  3828.  
  3829.          See also:  MENU, SELECT, APPMENU, QFORMAT
  3830.  
  3831.          Example:
  3832.  
  3833.              MENUCOLOR 0,3,1,14,2              ;;SET MENU COLORS/BORDER TYPE
  3834.              MENU What Do You Think?,Yes,No    ;;DISPLAY A MENU USING THEM
  3835.  
  3836.  
  3837.        ,---------------------------------------------------------------------,
  3838.          MENUSTARTMENUSTART line,column       |                                                                     |
  3839.        `---------------------------------------------------------------------'
  3840.          Overrides the default display position of the function key menu when
  3841.          the menu mode is active.
  3842.  
  3843.          Normally the  function key  menu is displayed centered in the middle
  3844.          of the  screen.   You may  want to  adjust this  though if you use a
  3845.          [MENUAUTO] definition  to display  some other information, or if you
  3846.          make extensive  use of cascaded submenus (the GOSUBMF command with a
  3847.          /C switch).
  3848.  
  3849.          The line  and column  specified refer  to the top left corner of the
  3850.          menu.
  3851.  
  3852.          This command  is only recognized in a [MENUAUTO] definition.  If you
  3853.          use this  command in  the [MENUAUTO] definition of a macro file that
  3854.          calls another  macro file  using GOSUBMF  with the  /C  switch,  the
  3855.          called macro  file should  also contain a [MENUAUTO] definition with
  3856.          the same MENUSTART parameters.
  3857.  
  3858.          See also:  MENUCOLOR
  3859.  
  3860.          Example:
  3861.  
  3862.              MENUSTART 8,14          ;;OVERRIDE MENU DISPLAY POSITION
  3863.  
  3864.  
  3865.        ,---------------------------------------------------------------------,
  3866.          MENUTITLEMENUTITLE title       |                                                                     |
  3867.        `---------------------------------------------------------------------'
  3868.          Sets the title of the macro file's menu.
  3869.  
  3870.  
  3871.  
  3872.  
  3873.                                           59
  3874.  
  3875.  
  3876.                                      Macro Language - Macro Command Reference
  3877.        ----------------------------------------------------------------------
  3878.  
  3879.  
  3880.          Normally the  first significant  line of a macro file is used to set
  3881.          the menu  title.  This command is provided as an optional way to set
  3882.          the menu  title if the first line is needed for something else, like
  3883.          an INCLUDE  command.   INCLUDE and  MENUTITLE are  the only commands
  3884.          recognizable before  the first  macro definition  starts in  a macro
  3885.          file.
  3886.  
  3887.          Unlike almost  all other  macro commands, this command is handled by
  3888.          the internal  compiler -  not by  the macro  engine during  runtime.
  3889.          This means  you can't  do something  like nest it in an IF block and
  3890.          expect different menu titles depending on certain conditions.
  3891.  
  3892.          Example:
  3893.  
  3894.              MENUTITLE Main Menu     ;;SET THE MENU TITLE
  3895.  
  3896.  
  3897.        ,---------------------------------------------------------------------,
  3898.          MULMUL destination,source       |                                                                     |
  3899.        `---------------------------------------------------------------------'
  3900.          Performs a  32-bit signed  integer multiply  operation using the two
  3901.          operands.
  3902.  
  3903.          The destination operand must be a user variable.  The source operand
  3904.          can be a combination of literal text and/or macro variables.
  3905.  
  3906.          The source  operand can  also include  in-line arithmetic,  which is
  3907.          evaluated from  left to  right without regard for standard algebraic
  3908.          order (i.e. multiplication before addition).
  3909.  
  3910.          The result  of the  operation is  returned in  the destination  user
  3911.          variable.
  3912.  
  3913.          See also:  ADD, SUB, DIV
  3914.  
  3915.          Examples:
  3916.  
  3917.              %VAR1=12                ;;%VAR1 = 12
  3918.              %VAR2=23                ;;%VAR2 = 23
  3919.              MUL %VAR1,2             ;;%VAR1 = 24    (12*2)
  3920.              MUL %VAR1,%VAR2         ;;%VAR1 = 552   (24*23)
  3921.              MUL %VAR1,%VAR2+3*2     ;;%VAR1 = 28704 (552*((23+3)*2))
  3922.  
  3923.  
  3924.        ,---------------------------------------------------------------------,
  3925.          ONBREAKGOTOONBREAKGOTO [key:]label       |                                                                     |
  3926.        `---------------------------------------------------------------------'
  3927.          Traps the Escape key when menus or prompts are active and also traps
  3928.          Ctrl-C aborts at any time.
  3929.  
  3930.          If no  trap is  set with this command, either pressing Escape during
  3931.          any macro  command that  pauses for a keyboard response, or pressing
  3932.  
  3933.  
  3934.                                           60
  3935.  
  3936.  
  3937.                                      Macro Language - Macro Command Reference
  3938.        ----------------------------------------------------------------------
  3939.  
  3940.  
  3941.          Ctrl-C at  any time  that the  macro engine is executing, will cause
  3942.          macro execution to abort immediately.
  3943.  
  3944.          The label  specified is where execution jumps to if an abort occurs.
  3945.          If no  label is  specified, break  trapping is cancelled.  The rules
  3946.          governing the  use of  labels are  the same as those for the GOTO or
  3947.          GOSUB macro commands.
  3948.  
  3949.          Break trapping is automatically reset when a new macro file loads.
  3950.  
  3951.          One use for this command is to build layered submenus that return to
  3952.          the previous  menu when Escape is pressed.  Another would be to trap
  3953.          the Escape  key when  a gosub'd  macro file  is running as a program
  3954.          under a  [FILEAUTO] definition,  and it  should always RETURN to the
  3955.          previous macro file.
  3956.  
  3957.          Example:
  3958.  
  3959.              [F1] SUB MENUS                    ;;TITLE LINE AND SWITCHES
  3960.              :MAIN_MENU                        ;;MAIN MENU JUMP POINT
  3961.                ONBREAKGOTO                     ;;RESET TRAP SO MAC CAN ABORT
  3962.                MENU Main Menu,Go,Jump          ;;DISPLAY MAIN MENU
  3963.                GOTO %MT                        ;;GOTO OPTION PICKED
  3964.                :GO                             ;;GO MENU JUMP POINT
  3965.                  ONBREAKGOTO MAIN_MENU         ;; SET ESC TRAP TO MAIN MENU
  3966.                  MENU Go Where?,Home,Sleep     ;; DISPLAY GO MENU
  3967.                  ONBREAKGOTO GO                ;; SET ESC TRAP TO GO MENU
  3968.                  MENU Can't Go to %MT          ;; ABUSE USER WITH
  3969.                   .Press Return to Continue    ;;  MENU RESPONSE
  3970.                  GOTO GO                       ;; GO BACK TO GO MENU
  3971.                :JUMP                           ;;JUMP MENU JUMP POINT
  3972.                  ONBREAKGOTO MAIN_MENU         ;; SET ESC TRAP TO MAIN MENU
  3973.                  MENU How High?,12",24",48"    ;; DISPLAY JUMP MENU
  3974.                  ONBREAKGOTO JUMP              ;; SET ESC TRAP TO JUMP MENU
  3975.                  MENU Can't Jump %MT           ;; ABUSE USER WITH
  3976.                   .Press Return to Continue    ;;  MENU RESPONSE
  3977.                  GOTO JUMP                     ;; GO BACK TO JUMP MENU
  3978.  
  3979.  
  3980.        ,---------------------------------------------------------------------,
  3981.          ONERRORGOTOONERRORGOTO [key:]label       |                                                                     |
  3982.        `---------------------------------------------------------------------'
  3983.          Traps runtime errors.
  3984.  
  3985.          If no  trap is  set with  this command,  macro runtime  errors  will
  3986.          produce a  dialog box  that describes  the error  and shows the line
  3987.          that caused it.  Macro execution then terminates immediately.
  3988.  
  3989.          The label  specified is where execution jumps to if an error occurs.
  3990.          If no  label is  specified, error  trapping is cancelled.  The rules
  3991.          governing the  use of  labels are  the same as those for the GOTO or
  3992.          GOSUB macro commands.
  3993.  
  3994.  
  3995.                                           61
  3996.  
  3997.  
  3998.                                      Macro Language - Macro Command Reference
  3999.        ----------------------------------------------------------------------
  4000.  
  4001.  
  4002.          Error trapping is automatically reset when a new macro file loads.
  4003.  
  4004.          When control  jumps to an error handler, it should immediately reset
  4005.          error trapping  to avoid  the possibility of an endless loop.  While
  4006.          an error  handler is  active, %ET will contain the exact text of the
  4007.          error, %EL  will equal the error number (refer to the appendices for
  4008.          error number  descriptions), and  %LE will return the line number of
  4009.          the error in the macro file.
  4010.  
  4011.          If the  error handler  only wants  to check  for something, or close
  4012.          something, and  then terminate using the macro engine's normal error
  4013.          handler, it could then just issue an undocumented command to display
  4014.          the error.
  4015.  
  4016.          See also:  %EL, %ET, %LE
  4017.  
  4018.          Example:
  4019.  
  4020.              ONERRORGOTO ERROR                 ;;SET ERROR TRAP
  4021.              OPEN #1,C:\MYDATA.TXT             ;;ATTEMPT TO OPEN A FILE
  4022.              DO WHILE NOT EOF (1)              ;;DO WHILE NOT END OF FILE
  4023.                READLN #1,%TEXT                 ;; %TEXT=NEXT LINE
  4024.                ECHO %TEXT                      ;; DISPLAY IT
  4025.              ENDDO                             ;;END OF DO WHILE BLOCK
  4026.              CLOSE                             ;;CLOSE ALL OPEN FILES
  4027.              EXIT                              ;;EXIT THE MACRO
  4028.  
  4029.              :ERROR                            ;;ERROR HANDLER
  4030.                ONERRORGOTO                     ;;RESET ERROR TRAPPING
  4031.                CLOSE                           ;;CLOSE THE FILE
  4032.                BEEP                            ;;BEEP THE SPEAKER
  4033.                MENU Error: %ET                 ;;USE MENU COMMAND TO
  4034.                 .Press Ret to Continue         ;;  DISPLAY ERROR TEXT
  4035.                EXIT                            ;;EXIT THE MACRO
  4036.  
  4037.  
  4038.        ,---------------------------------------------------------------------,
  4039.          OPENOPEN [#]filenumber,[d:][path]filename [/a][/w]       |                                                                     |
  4040.        `---------------------------------------------------------------------'
  4041.          Opens a  file for  reading or  writing and associates it with a file
  4042.          number.
  4043.  
  4044.          The file I/O system loosely follows that of formatted sequential I/O
  4045.          commands in  BASIC.  It is designed primarily for working with ASCII
  4046.          text files.
  4047.  
  4048.          Before a  file can  be read  or written  it must first be opened (or
  4049.          created) and  associated with  a file  number.   There are  10  file
  4050.          numbers available  (0..9), so  you can have as many as 10 files open
  4051.          simultaneously (provided  your CONFIG.SYS file has a FILES statement
  4052.          which allows  it).  Files stay open until macro execution terminates
  4053.  
  4054.  
  4055.  
  4056.                                           62
  4057.  
  4058.  
  4059.                                      Macro Language - Macro Command Reference
  4060.        ----------------------------------------------------------------------
  4061.  
  4062.  
  4063.          (at which  time they  will be  closed automatically if any are still
  4064.          left open).
  4065.  
  4066.          If no  switches are  specified, this  command opens  a file for read
  4067.          access only, and will fail with an error if the file isn't found.
  4068.  
  4069.          Optional Switches:
  4070.  
  4071.          /A/A  Opens the  file for  appending.   When this  switch is used, the
  4072.              file is  opened for  write access  and the file position pointer
  4073.              moved to  the end  of file.   If  the file  isn't found,  it  is
  4074.              created.
  4075.  
  4076.          /W/W  Opens the  file for writing.  When this switch is used, the file
  4077.              is opened  for write  access and the file position pointer is at
  4078.              the beginning  of file.  If the file isn't found, it is created.
  4079.              Using this  switch can be dangerous if the lines written are not
  4080.              fixed length,  because the  previous contents  of the  file past
  4081.              what is written remain intact.
  4082.  
  4083.          See also:  CREATE, READ, READLN, WRITE, CLOSE, %FP
  4084.  
  4085.          Example:
  4086.  
  4087.              OPEN #1,C:\CONFIG.SYS             ;;OPEN C:\CONFIG.SYS
  4088.              DO WHILE NOT EOF (1)              ;;DO WHILE NOT END OF FILE
  4089.                READLN #1,%TEXT                 ;; READ NEXT LINE
  4090.                ECHO %TEXT                      ;; DISPLAY IT
  4091.              ENDDO                             ;;END OF DO BLOCK
  4092.              CLOSE #1                          ;;CLOSE THE FILE
  4093.  
  4094.  
  4095.        ,---------------------------------------------------------------------,
  4096.          PATHPATH [=]path       |                                                                     |
  4097.        `---------------------------------------------------------------------'
  4098.          Sets the MS-DOS PATH environment variable.
  4099.  
  4100.          This command  behaves the  same as  its MS-DOS  equivalent.   It  is
  4101.          mentioned here  primarily to  indicate that  it is an internal macro
  4102.          command handled by the macro engine.
  4103.  
  4104.          See also:  PATHADD, PATHDEL, PROMPT, SET
  4105.  
  4106.  
  4107.        ,---------------------------------------------------------------------,
  4108.          PATHADDPATHADD path       |                                                                     |
  4109.        `---------------------------------------------------------------------'
  4110.          Adds an entry to the PATH environment variable.
  4111.  
  4112.          This command  provides an  on-the-fly method  of quickly  adding  an
  4113.          entry in the path to a program's directory before a macro definition
  4114.          runs it.
  4115.  
  4116.  
  4117.                                           63
  4118.  
  4119.  
  4120.                                      Macro Language - Macro Command Reference
  4121.        ----------------------------------------------------------------------
  4122.  
  4123.  
  4124.          If the  same entry  already exists in the path, it will not be added
  4125.          twice.   Multiple path  entries  can  be  added  using  one  PATHADD
  4126.          instruction (for example: "PATHADD C:\WORD;C:\DOCS").
  4127.  
  4128.          When you are adding only a single entry, whether you trail it with a
  4129.          semi-colon is  subjective.  The PATHADD command will ensure that the
  4130.          entry is  installed correctly  in the  path.    If  you  are  adding
  4131.          multiple entries  with one  PATHADD command,  they must  be properly
  4132.          separated with  a semi-colon,  but the  trailing semi-colon is still
  4133.          optional.
  4134.  
  4135.          The path text is inserted at the start of the path, which produces a
  4136.          quick response  when the  program is run by not having to search any
  4137.          other path entries before finding the program's executable file.
  4138.  
  4139.          dCOM's PATH environment is not limited to 128 characters like MS-DOS
  4140.          is (actually  its a  COMMAND.COM limitation).  The only limit is the
  4141.          actual size of the environment.  If COMMAND.COM gets mixed up in the
  4142.          middle of  running something though, its PATH variable will probably
  4143.          be a truncated version of dCOM's after the 128th character.
  4144.  
  4145.          Note:  dCOM has  a unique  feature where if a path entry begins with
  4146.          an "@"  symbol, all  subdirectories in  that path  will be  searched
  4147.          instead of  the files  that are  in that  path.   Refer to  the file
  4148.          handler's documentation for more information.
  4149.  
  4150.          See also:  PATHDEL, SET
  4151.  
  4152.          Example:
  4153.  
  4154.              [F1] MS-WORD            ;;TITLE LINE AND SWITCHES
  4155.              PATHADDPATHADD C:\WORD         ;;ADD C:\WORD TO THE PATH
  4156.              WORD                    ;;RUN MS-WORD
  4157.              PATHDEL C:\WORD         ;;REMOVE C:\WORD FROM THE PATH
  4158.              CDDO                    ;;RETURN TO ORIG DRIVE & DIR
  4159.  
  4160.  
  4161.        ,---------------------------------------------------------------------,
  4162.          PATHDELPATHDEL path       |                                                                     |
  4163.        `---------------------------------------------------------------------'
  4164.          Removes an entry from the PATH environment variable.
  4165.  
  4166.          This command  is normally used to remove a path entry that was added
  4167.          with PATHADD, after it is no longer needed.
  4168.  
  4169.          See also:  PATHADD, SET
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.  
  4176.  
  4177.  
  4178.                                           64
  4179.  
  4180.  
  4181.                                      Macro Language - Macro Command Reference
  4182.        ----------------------------------------------------------------------
  4183.  
  4184.  
  4185.        ,---------------------------------------------------------------------,
  4186.          PAUSEPAUSE [text]       |                                                                     |
  4187.        `---------------------------------------------------------------------'
  4188.          Displays the  message "Press  Return to Proceed or Escape to Cancel"
  4189.          and waits for a proper response.
  4190.  
  4191.          If text  is also  supplied, it is displayed on the line prior to the
  4192.          pause message.
  4193.  
  4194.          If the  Escape key  is pressed  at the  prompt, the macro key aborts
  4195.          execution unless trapped with ONBREAKGOTO.
  4196.  
  4197.          See also:  KEYWAIT
  4198.  
  4199.  
  4200.        ,---------------------------------------------------------------------,
  4201.          PRINTFILPRINTFIL [d:][path]filename [/lpt#][/v]       |                                                                     |
  4202.        `---------------------------------------------------------------------'
  4203.          Prints a file.
  4204.  
  4205.          If dCOM's  print spooler is enabled, when this command prints a file
  4206.          it passes  large "chunks"  of the file directly to the spooler, in a
  4207.          very expeditious manner.
  4208.  
  4209.          The filename may include wildcards.
  4210.  
  4211.          This command  prints files using the same logic as the file handler.
  4212.          If the  file contains one or more escape characters it is considered
  4213.          a binary file and is printed as is.  If the file does not contain an
  4214.          escape character,  a form-feed will be appended to the output if the
  4215.          last printed  character was  not a form-feed.  And also, if an ASCII
  4216.          End-of-File marker  (Ctrl-Z) is  encountered, printing  will stop at
  4217.          the character before it.
  4218.  
  4219.          Optional Switches:
  4220.  
  4221.           /LPT#/LPT# Specifies which  printer port  to print  the file(s) to (i.e.
  4222.                 /LPT1, etc...).   If  this switch isn't specified, the output
  4223.                 will go to the file handler's default printer port.
  4224.  
  4225.           /V/V    Causes a verbose display of each file printed that includes a
  4226.                 counter which indicates printing progress.
  4227.  
  4228.          See also:  PRINTSTR
  4229.  
  4230.  
  4231.        ,---------------------------------------------------------------------,
  4232.          PRINTSTRPRINTSTR text       |                                                                     |
  4233.        `---------------------------------------------------------------------'
  4234.          Sends a text string to the default printer device.
  4235.  
  4236.  
  4237.  
  4238.  
  4239.                                           65
  4240.  
  4241.  
  4242.                                      Macro Language - Macro Command Reference
  4243.        ----------------------------------------------------------------------
  4244.  
  4245.  
  4246.          A carriage return/line-feed  sequence is  NOT automatically appended
  4247.          to the  text printed.   If one is needed, append a "%(13)%(10)" onto
  4248.          the end of the text.
  4249.  
  4250.          This command  properly handles  any control  codes you might need to
  4251.          send (e.g.  Esc =  "%(27)", and  ASCII null = "%(0)").  You can also
  4252.          use variables  embedded inside  the system %(nnn) character variable
  4253.          if you want to send a code that was based on something like say what
  4254.          a user selected for the value of a left margin.
  4255.  
  4256.          See also:  PRINTFIL
  4257.  
  4258.          Example:
  4259.  
  4260.              [F1] SET COMPRESSED     ;;TITLE LINE AND SWITCHES
  4261.              PRINTSTRPRINTSTR %(15)          ;;SEND EPSON COMPRESSED CODE
  4262.  
  4263.  
  4264.        ,---------------------------------------------------------------------,
  4265.          PROMPTPROMPT [=]prompt       |                                                                     |
  4266.        `---------------------------------------------------------------------'
  4267.          Sets the MS-DOS PROMPT environment variable.
  4268.  
  4269.          This command  behaves the  same as  its MS-DOS  equivalent.   It  is
  4270.          mentioned here  primarily to  indicate that  it is an internal macro
  4271.          command handled by the macro engine.
  4272.  
  4273.          See also:  PATH, SET
  4274.  
  4275.  
  4276.        ,---------------------------------------------------------------------,
  4277.          QFORMATQFORMAT [d:]       |                                                                     |
  4278.        `---------------------------------------------------------------------'
  4279.          Quick Format's a floppy disk, completely erasing its contents.
  4280.  
  4281.          Quick formatting  cannot initialize  a brand  new disk.    It  works
  4282.          quickly by  only resetting directory and FAT information on a disk's
  4283.          boot track.
  4284.  
  4285.          If a  drive isn't  specified, QFORMAT  will prompt for it.  A syntax
  4286.          error is produced if a drive other than A: or B: is specified.
  4287.  
  4288.          The status of a QFORMAT operation can be tested afterwards using the
  4289.          %EL (errorlevel) system variable (0=successful, 1=error).
  4290.  
  4291.          This command  does not  prompt before  proceeding if  the  drive  is
  4292.          supplied as  a parameter.   If  you want  to provide  a confirmation
  4293.          prompt, use the MENU command to do so first.
  4294.  
  4295.          This command  also recognizes the menuing-type switches described on
  4296.          page 30.
  4297.  
  4298.  
  4299.  
  4300.                                           66
  4301.  
  4302.  
  4303.                                      Macro Language - Macro Command Reference
  4304.        ----------------------------------------------------------------------
  4305.  
  4306.  
  4307.          See also:  MENUCOLOR
  4308.  
  4309.  
  4310.        ,---------------------------------------------------------------------,
  4311.          RDRD [d:][path]dirname       |                                                                     |
  4312.          RMDIRRMDIR [d:][path]dirname       |                                                                     |
  4313.        `---------------------------------------------------------------------'
  4314.          Removes (deletes) a subdirectory.
  4315.  
  4316.          The  directory   being  removed   must  be   empty  of   files   and
  4317.          subdirectories.
  4318.  
  4319.          This macro  command  is  functionally  equivalent  with  its  MS-DOS
  4320.          counterpart.
  4321.  
  4322.          See also:  MD
  4323.  
  4324.  
  4325.        ,---------------------------------------------------------------------,
  4326.          READREAD [#]filenumber[,var][,var][,var][,var...]       |                                                                     |
  4327.        `---------------------------------------------------------------------'
  4328.          Reads the  next line  from an  open file  number into a list of user
  4329.          variables.
  4330.  
  4331.          The file  number specified  must first have been opened with an OPEN
  4332.          command.
  4333.  
  4334.          This command  expects fields  within the line being read to be comma
  4335.          delimited.   If more user variables are specified than fields found,
  4336.          the extra variables will be assigned null values.
  4337.  
  4338.          The file  position pointer  is advanced  to the next line after each
  4339.          READ  command,  irregardless  of  whether  there  were  enough  user
  4340.          variables to  receive the fields in the line read.  Macros should do
  4341.          their own  end of  file checking  before issuing  a READ  command to
  4342.          avoid "Read Past EOF" runtime errors.
  4343.  
  4344.          See also:  OPEN, READLN, WRITE, CLOSE, %FP
  4345.  
  4346.          Example:
  4347.  
  4348.              OPEN #1,C:\TESTDAT.TXT       ;;OPEN C:\TESTDAT.TXT
  4349.              READ #1,%VAR1,%VAR2,%VAR3    ;;READ IN FIELDS
  4350.              CLOSE #1                     ;;CLOSE THE FILE
  4351.  
  4352.  
  4353.        ,---------------------------------------------------------------------,
  4354.          READBREADB [#]filenumber,length,var       |                                                                     |
  4355.        `---------------------------------------------------------------------'
  4356.          Reads from an open file number into a user variable.
  4357.  
  4358.  
  4359.  
  4360.  
  4361.                                           67
  4362.  
  4363.  
  4364.                                      Macro Language - Macro Command Reference
  4365.        ----------------------------------------------------------------------
  4366.  
  4367.  
  4368.          The file  number specified  must first have been opened with an OPEN
  4369.          command.
  4370.  
  4371.          The "length"  parameter is the number of bytes to read into the user
  4372.          variable.
  4373.  
  4374.          The file  position pointer  is advanced  to the  next byte following
  4375.          that which was read.  This command is normally used to read files in
  4376.          a binary  fashion as  opposed to  reading text  files with  the READ
  4377.          command.   Macros should  do their  own end  of file checking before
  4378.          issuing a  READB command  to avoid  "Read Past  EOF" runtime errors.
  4379.          This can  be done  by comparing  the %FP system variable against the
  4380.          result of a previously issued %SF() variable.
  4381.  
  4382.          See also:  OPEN, READ, WRITEB, CLOSE, %FP
  4383.  
  4384.  
  4385.        ,---------------------------------------------------------------------,
  4386.          READLNREADLN [#]filenumber[,var]       |                                                                     |
  4387.        `---------------------------------------------------------------------'
  4388.          Reads the next line from an open file number into a user variable.
  4389.  
  4390.          The file  number specified  must first have been opened with an OPEN
  4391.          command.
  4392.  
  4393.          Unlike the  READ command  which expects fields within the line being
  4394.          read to  be comma delimited, this command reads the entire line into
  4395.          one user variable up to the Carriage Return (including commas).
  4396.  
  4397.          The file  position pointer  is advanced  to the next line after each
  4398.          READLN command.   Macros  should do  their own  end of file checking
  4399.          before issuing  a READLN  command to  avoid "Read  Past EOF" runtime
  4400.          errors.
  4401.  
  4402.          See also:  OPEN, READ, WRITE, CLOSE, %FP, %TL, %TR
  4403.  
  4404.          Example:
  4405.  
  4406.              OPEN #1,C:\CONFIG.SYS   ;;OPEN C:\CONFIG.SYS
  4407.              DO WHILE NOT EOF (1)    ;;DO WHILE NOT END OF FILE
  4408.                READLN #1,%TEXT       ;; READ NEXT LINE
  4409.                ECHO %TEXT            ;; DISPLAY IT
  4410.              ENDDO                   ;;END OF DO BLOCK
  4411.              CLOSE #1                ;;CLOSE THE FILE
  4412.  
  4413.  
  4414.        ,---------------------------------------------------------------------,
  4415.          REBOOTREBOOT [/c]       |                                                                     |
  4416.        `---------------------------------------------------------------------'
  4417.          Causes the computer to reset and do a warm boot.
  4418.  
  4419.  
  4420.  
  4421.  
  4422.                                           68
  4423.  
  4424.  
  4425.                                      Macro Language - Macro Command Reference
  4426.        ----------------------------------------------------------------------
  4427.  
  4428.  
  4429.          Optional Switches:
  4430.  
  4431.           /C/C    Forces a cold boot instead of a warm boot.
  4432.  
  4433.  
  4434.        ,---------------------------------------------------------------------,
  4435.          RECOMPILERECOMPILE [d:][path]macrofile [/v]       |                                                                     |
  4436.        `---------------------------------------------------------------------'
  4437.          Manually recompiles a macro file.
  4438.  
  4439.          This is  an advanced  command which  is normally not necessary.  The
  4440.          macro engine  automatically recompiles  macro files when needed.  It
  4441.          won't however,  automatically detect  when an  include file has been
  4442.          modified.   This command  might also  be needed on a network so that
  4443.          the administrator  can recompile  all network  macro files, ensuring
  4444.          that all  .CMF files  are current because normal network users might
  4445.          not have  sufficient  rights  to  rewrite  them  under  their  login
  4446.          privileges, or  when one  or more  of the  macro files make use of a
  4447.          common include file that has been changed.
  4448.  
  4449.          The filename  may include wildcards, but the extension is assumed to
  4450.          be ".MAC".
  4451.  
  4452.          An optional  path may  be specified prior to the macro filename.  If
  4453.          no path is specified, the macro file(s) are assumed to be located in
  4454.          dCOM's home directory.
  4455.  
  4456.          Optional Switches:
  4457.  
  4458.           /V/V    Causes a verbose display of each macro file compiled.
  4459.  
  4460.          See also:  INCLUDE
  4461.  
  4462.  
  4463.        ,---------------------------------------------------------------------,
  4464.          REMREM [text]       |                                                                     |
  4465.        `---------------------------------------------------------------------'
  4466.          Used to include a remark or comment text.
  4467.  
  4468.          Remark lines are ignored when compiled and consume no memory.
  4469.  
  4470.  
  4471.        ,---------------------------------------------------------------------,
  4472.          RETURNRETURN       |                                                                     |
  4473.        `---------------------------------------------------------------------'
  4474.          Returns from  either a  procedure GOSUB  or a  macro  file  GOSUBMF,
  4475.          depending on  which was  last used.   If  GOSUBMF was last used, the
  4476.          previous macro  file is reloaded and execution resumes with the line
  4477.          following the GOSUBMF statement.
  4478.  
  4479.          If RETURN  is encountered and nothing has been gosub'd to, no action
  4480.          is taken and execution continues with the following macro line.
  4481.  
  4482.  
  4483.                                           69
  4484.  
  4485.  
  4486.                                      Macro Language - Macro Command Reference
  4487.        ----------------------------------------------------------------------
  4488.  
  4489.  
  4490.          See also:  GOSUB, GOSUBMF
  4491.  
  4492.  
  4493.        ,---------------------------------------------------------------------,
  4494.          RSTWINRSTWIN [/n]       |                                                                     |
  4495.        `---------------------------------------------------------------------'
  4496.          Restores the  video screen  back to  the way  it was before a WINDOW
  4497.          command was used.
  4498.  
  4499.          Video attributes  also included  by this are cursor position, active
  4500.          colors/attributes, window boundaries, etc....
  4501.  
  4502.          Optional Switches:
  4503.  
  4504.           /N/N    If the  last action  saved on  the window  stack was a WINDOW
  4505.                 command, this option properly 'pops' the saved window off the
  4506.                 windowing stack  and  restores  the  saved  video  attributes
  4507.                 (cursor position,  active colors,  etc...), but it leaves the
  4508.                 window on the screen instead of replacing the window with its
  4509.                 previous contents.
  4510.  
  4511.          See also:  WINDOW
  4512.  
  4513.          Example:
  4514.  
  4515.              WINDOW 1,1,3,80,1,7,1,1      ;;DISPLAY A BOX ON THE SCREEN
  4516.              CPOSN ,40                    ;;POSITION TO CENTER OF WINDOW
  4517.              ECHOC This Screen's Title;   ;;ECHO TEXT CENTERED ON CURSOR
  4518.              RSTWIN /N                    ;;FREE WIN MEM, BUT KEEP BOX
  4519.  
  4520.  
  4521.        ,---------------------------------------------------------------------,
  4522.          RUNMACRORUNMACRO key       |                                                                     |
  4523.        `---------------------------------------------------------------------'
  4524.          Causes execution to jump to the macro key specified.  Multiple key's
  4525.          can be given by preceding their occurrence(s) with a "/".
  4526.  
  4527.          Example:
  4528.  
  4529.              [MENUAUTO]                   ;;RUNS BEFORE MENU DISPLAYS
  4530.              RUNMACRO RUNMACRO F10                 ;;EXECUTE THE F10 KEY
  4531.  
  4532.  
  4533.        ,---------------------------------------------------------------------,
  4534.          SELECTSELECT [d:][path]mask [title] [/d][/h][/n][/p][/v]       |                                                                     |
  4535.        `---------------------------------------------------------------------'
  4536.          Displays a  menu of  files found  in mask.   A selected filename can
  4537.          then be  accessed in  following macro  lines using  the %SN  and %SE
  4538.          system variables.   The  count of  files found  with the mask can be
  4539.          accessed with the %SC system variable.
  4540.  
  4541.  
  4542.  
  4543.  
  4544.                                           70
  4545.  
  4546.  
  4547.                                      Macro Language - Macro Command Reference
  4548.        ----------------------------------------------------------------------
  4549.  
  4550.  
  4551.          If no  files qualify  with  the  mask,  no  menu  is  displayed  and
  4552.          execution continues  with the following macro line.  The %SN and %SE
  4553.          variables will then return a null string.  If needed, this condition
  4554.          can be tested for using the %SC variable in an IF command, after the
  4555.          SELECT command.
  4556.  
  4557.          If the  menu is cancelled with the Escape key or mouse right button,
  4558.          macro execution aborts unless trapped with ONBREAKGOTO.
  4559.  
  4560.          Any text  following the  mask will be displayed as header text above
  4561.          the menu of files found.
  4562.  
  4563.          This command  also recognizes the menuing-type switches described on
  4564.          page 30.
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577.  
  4578.  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.                                           71
  4606.  
  4607.  
  4608.                                      Macro Language - Macro Command Reference
  4609.        ----------------------------------------------------------------------
  4610.  
  4611.  
  4612.          Optional Switches:
  4613.  
  4614.           /D/D    Specifies that  subdirectory entries  are  to  be  found  and
  4615.                 displayed instead of files.
  4616.  
  4617.           /H/H    Specifies that  hidden files  (or subdirectories)  are to  be
  4618.                 shown as well.
  4619.  
  4620.           /N/N    Specifies that a "[NewFile]" option should also be displayed.
  4621.                 If "[NewFile]"  is selected,  the %SN  and %SE variables will
  4622.                 return a null (empty) string.  If you then run a program only
  4623.                 using one  of these  variables as  its parameters,  a lot  of
  4624.                 programs will  then assume  a new file since it just received
  4625.                 nothing on  its command  line.   If you  wish to test whether
  4626.                 "[NewFile]" has been selected before running the program, you
  4627.                 could use the IF command as follows: "IF %SE="" THEN...".
  4628.  
  4629.           /P/P    Allows the  menu to  dynamically select  files  in  different
  4630.                 subdirectories (or drives) than that which the menu initially
  4631.                 started with.   When  this switch  is used,  the SELECT  menu
  4632.                 shows both  subdirectories and files.  When a subdirectory is
  4633.                 selected, the  menu  reappears  showing  the  files  in  that
  4634.                 directory.   If the  "[..]" entry  is selected  from the root
  4635.                 directory, the  user is  then  given  the  option  to  change
  4636.                 drives.   When this  switch is  used, %SP  should be  used in
  4637.                 combination with %SN or %SE to determine the full path of the
  4638.                 entry selected.   Using  the /P  switch does  not change  the
  4639.                 current directory.
  4640.  
  4641.                 Whether hidden  directories show  when this switch is used is
  4642.                 governed by  the current  user's access  control  privileges.
  4643.                 Whether  hidden   files  are  shown  is  controlled  by  this
  4644.                 command's /H switch.
  4645.  
  4646.           /V/V    Causes the  SELECT command  to display  a list of valid drive
  4647.                 letters to  select from  instead of  found files.   When this
  4648.                 switch is  used, SELECT  does not  expect a  file mask.   The
  4649.                 entire text  passed (except  switches) is considered the menu
  4650.                 title.
  4651.  
  4652.          See also:  MENU, MENUCOLOR, %SN, %SE, %SP
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.                                           72
  4667.  
  4668.  
  4669.                                      Macro Language - Macro Command Reference
  4670.        ----------------------------------------------------------------------
  4671.  
  4672.  
  4673.          Example:
  4674.  
  4675.              [F1] RUN MS-WORD                  ;;TITLE LINE AND SWITCHES
  4676.              C:                                ;;SET DRIVE C AS DEFAULT
  4677.              CD \WORD                          ;;CHANGE DIR'S TO \WORD
  4678.              SELECTSELECT *.doc Pick a File /N       ;;PICK A FILE TO EDIT
  4679.              WORD %SE%SE                          ;;RUN MS-WORD WITH THE FILE
  4680.              CD \                              ;;CHANGE DIR'S BACK TO ROOT
  4681.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR
  4682.  
  4683.  
  4684.        ,---------------------------------------------------------------------,
  4685.          SETSET envvar=text       |                                                                     |
  4686.        `---------------------------------------------------------------------'
  4687.          Sets an environment variable.
  4688.  
  4689.          An environment variable can be set to itself plus additional text by
  4690.          using: "SET  PATH=%[PATH];c:\test".
  4691.  
  4692.          This command  behaves identically with its MS-DOS counterpart except
  4693.          that it doesn't "puke" when environment space is full.
  4694.  
  4695.  
  4696.        ,---------------------------------------------------------------------,
  4697.          SHIPSHIP       |                                                                     |
  4698.        `---------------------------------------------------------------------'
  4699.          Ships (parks) the heads on all internal hard disks present.
  4700.  
  4701.          Macro execution  will continue  after the  SHIP command finishes, so
  4702.          you need  to provide  your own  pause  message  to  ensure  no  disk
  4703.          activity occurs afterwards.
  4704.  
  4705.          Example:
  4706.  
  4707.              [F10] SHIP HARD DISK         ;;TITLE LINE AND SWITCHES
  4708.              SHIPSHIP                         ;;SHIP THE HARD DISK(S)
  4709.              MENU Hard Disks Shipped      ;;DISPLAY MENU
  4710.               .Shut Down                  ;; FOR WHAT TO
  4711.               .Abort                      ;; DO NEXT
  4712.              IF %MS=1 THEN                ;;IF RESPONSE IS SHUT DOWN
  4713.                CLS                        ;; CLEAR THE SCREEN
  4714.                BEEP                       ;; BEEP SPEAKER
  4715.                ECHO Turn Power Off Now;   ;; TELL USER WHAT TO DO
  4716.                :LOCKCITY                  ;; LABEL TO LOCK COMPUTER WITH
  4717.                GOTO LOCKCITY              ;; ENDLESS LOOP
  4718.              ENDIF                        ;;END OF IF BLOCK
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.                                           73
  4728.  
  4729.  
  4730.                                      Macro Language - Macro Command Reference
  4731.        ----------------------------------------------------------------------
  4732.  
  4733.  
  4734.        ,---------------------------------------------------------------------,
  4735.          SUBSUB destination,source       |                                                                     |
  4736.        `---------------------------------------------------------------------'
  4737.          Performs a  32-bit signed  integer subtract  operation using the two
  4738.          operands.
  4739.  
  4740.          The destination operand must be a user variable.  The source operand
  4741.          can be a combination of literal text and/or macro variables.
  4742.  
  4743.          The source  operand can  also include  in-line arithmetic,  which is
  4744.          evaluated from  left to  right without regard for standard algebraic
  4745.          order (i.e. multiplication before addition).
  4746.  
  4747.          The result  of the  operation is  returned in  the destination  user
  4748.          variable.
  4749.  
  4750.          See also:  ADD, MUL, DIV
  4751.  
  4752.          Examples:
  4753.  
  4754.              %VAR1=23                ;;%VAR1 =  23
  4755.              %VAR2=12                ;;%VAR2 =  12
  4756.              SUB %VAR1,1             ;;%VAR1 =  22  (23-1)
  4757.              SUB %VAR1,%VAR2         ;;%VAR1 =  10  (22-12)
  4758.              SUB %VAR1,%VAR2+3*2     ;;%VAR1 = -20  (10-((12+3)*2))
  4759.  
  4760.  
  4761.        ,---------------------------------------------------------------------,
  4762.          VLISTVLIST [title]       |                                                                     |
  4763.        `---------------------------------------------------------------------'
  4764.          Displays the current contents of all active user variables.
  4765.  
  4766.          This command  might be useful for debugging purposes by inserting it
  4767.          at strategic points in your macro code.
  4768.  
  4769.          The output  of VLIST is redirectable to a file using the ">" or ">>"
  4770.          symbols.
  4771.  
  4772.  
  4773.        ,---------------------------------------------------------------------,
  4774.          WINDOWWINDOW sl,sc,el,ec,fc,bc,blc[,bt] [title]       |                                                                     |
  4775.        `---------------------------------------------------------------------'
  4776.          Displays a  general purpose  text window  on the  screen  using  the
  4777.          colors and coordinates provided.
  4778.  
  4779.          The contents  of the screen behind the window along with most of the
  4780.          current video attributes (colors, cursor position, etc...) are saved
  4781.          on dCOM's  windowing stack before the window is displayed.  When you
  4782.          are done  using the  window, they  are 'popped' off using the RSTWIN
  4783.          command.   With RSTWIN  you have  the option of restoring the window
  4784.          back to  its previous  contents, or leaving the window on the screen
  4785.          and only  restoring the  window stack  pointer (RSTWIN's /N switch).
  4786.  
  4787.  
  4788.                                           74
  4789.  
  4790.  
  4791.                                      Macro Language - Macro Command Reference
  4792.        ----------------------------------------------------------------------
  4793.  
  4794.  
  4795.          Multiple windows can be nested on the screen for as much as the size
  4796.          of the window stack allows.
  4797.  
  4798.          A WINDOW  is considered open until a matching RSTWIN is encountered.
  4799.          When a  window is  open, screen  writes are performed directly using
  4800.          dCOM's screen driver instead of using MS-DOS calls.  Any text echoed
  4801.          to the  screen while a window is open will use the active colors (as
  4802.          established by  the WINDOW  command, or a subsequent COLOR command),
  4803.          and will  scroll automatically  within the boundaries of the window.
  4804.          If the  cursor is  visible, the  window will scroll when a line feed
  4805.          causes it  to drop on the window's bottom border line, opening a new
  4806.          blank line.   If  the cursor not visible, the window will not scroll
  4807.          until an attempt is made to echo text to the window while the cursor
  4808.          is on  the window's  bottom border line.  When a window is initially
  4809.          opened, the  cursor is disabled.  It could then be enabled using one
  4810.          of two  undocumented commands.   When  the  window  is  closed  with
  4811.          RSTWIN, the  cursor is  restored to its original position before the
  4812.          window was opened.
  4813.  
  4814.          The size  of dCOM's  windowing stack defaults to a value that should
  4815.          prove sufficient  for most  windowing operations.   It  can  hold  a
  4816.          little over one full screen of saved windows (i.e. fourteen 5 line x
  4817.          30 column windows).  If you receive a Windowing Stack Overflow error
  4818.          when trying  to use  this command,  check to  ensure  that  you  are
  4819.          properly popping  windows off  the  window  stack  with  the  RSTWIN
  4820.          command.   If so, you may need to increase the size of the windowing
  4821.          stack by  using dCOM's  /W command  line switch (described in dCOM's
  4822.          file handler documentation).
  4823.  
  4824.          sl  sl  The window start line (1..25)
  4825.          sc  sc  The window start column (1..80)
  4826.          el  el  The window end line (1..25)
  4827.          ec  ec  The window end column (1..80)
  4828.          fc  fc  The active foreground color of the window (0..15)
  4829.          bc  bc  The active background color of the window (0..7)
  4830.          blc blc The foreground color of the border lines (0..15)
  4831.          bt  bt  An optional  border  line-type  override  (1..4).    1 = single-
  4832.              width lines,      2 = double-width lines,       3 = solid lines,
  4833.              4 = no border lines.   If this value isn't specified, the window
  4834.              uses whatever line type the file handler is configured for.
  4835.          title   title   Optional text  for the window's title.  If this parameter is
  4836.              used, the  text is  displayed centered  in the  window, one line
  4837.              below the  top border,  and another  single-width line  is drawn
  4838.              below the  text.   The text  is  displayed  using  the  window's
  4839.              foreground and background colors.
  4840.  
  4841.  
  4842.          See also:  RSTWIN, %W1, %W2, %W3, %W4
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.                                           75
  4850.  
  4851.  
  4852.                                      Macro Language - Macro Command Reference
  4853.        ----------------------------------------------------------------------
  4854.  
  4855.  
  4856.          Example:
  4857.  
  4858.              WINDOW 2,3,24,77,14,1,11,1 CONFIG.SYS  ;;DISP WINDOW ON THE SCN
  4859.              COLOR 15,1                             ;;CHG COLOR FOR BODY TEXT
  4860.              OPEN #1,C:\CONFIG.SYS                  ;;OPEN CONFIG.SYS FILE
  4861.              DO WHILE NOT EOF (1)                   ;;WHILE NOT END OF FILE
  4862.                READLN #1,%TEXT                      ;; %TEXT=NEXT LINE
  4863.                ECHO %TEXT                           ;; DISPLAY IT
  4864.              ENDDO                                  ;;CYCLE BACK IF NOT EOF
  4865.              CLOSE #1                               ;;CLOSE CONFIG.SYS
  4866.              KEYWAIT                                ;;WAIT FOR ANY KEY
  4867.              RSTWIN                                 ;;REMOVE THE WINDOW
  4868.  
  4869.  
  4870.        ,---------------------------------------------------------------------,
  4871.          WRITEWRITE [#]filenumber[,text]       |                                                                     |
  4872.        `---------------------------------------------------------------------'
  4873.          Writes a  line of  text to  the file associated with the file number
  4874.          specified.
  4875.  
  4876.          The file  number specified must first have been opened with either a
  4877.          CREATE or  OPEN command.   If  the file  was opened  with  the  OPEN
  4878.          command, either  its /A  or /W  switch must  have been  used so that
  4879.          write access will be allowed.
  4880.  
  4881.          The text  written can  be made up of any combination of literal text
  4882.          and/or user  variables.   A  Carriage Return/Line-Feed  sequence  is
  4883.          always appended  to the  text written.   The output text starts with
  4884.          the first  significant character  following the  file number  (other
  4885.          than a  trailing  comma).    Tabs  and  spaces  are  not  considered
  4886.          significant.
  4887.  
  4888.          If the  file being written is to be read in the future with the READ
  4889.          command using  multiple fields, express the output text using commas
  4890.          to separate the fields being written.
  4891.  
  4892.          See also:  CREATE, OPEN, READ, READLN, WRITEB, CLOSE, %FP
  4893.  
  4894.          Example:
  4895.  
  4896.              %VAR1=Field 1                     ;;%VAR1="Field 1"
  4897.              %VAR2=Field 2                     ;;%VAR2="Field 2"
  4898.              %VAR3=Field 3                     ;;%VAR3="Field 3"
  4899.              CREATE #1,C:\TESTDAT.TXT          ;;CREATE C:\TESTDAT.TXT
  4900.              WRITE #1,%VAR1,%VAR2,%VAR3        ;;WRITE THE FIELDS
  4901.              CLOSE #1                          ;;CLOSE THE FILE
  4902.  
  4903.  
  4904.        ,---------------------------------------------------------------------,
  4905.          WRITEBWRITEB [#]filenumber[,text]       |                                                                     |
  4906.        `---------------------------------------------------------------------'
  4907.          Writes text to the file associated with the file number specified.
  4908.  
  4909.  
  4910.                                           76
  4911.  
  4912.  
  4913.                                      Macro Language - Macro Command Reference
  4914.        ----------------------------------------------------------------------
  4915.  
  4916.  
  4917.          The file  number specified must first have been opened with either a
  4918.          CREATE or  OPEN command.   If  the file  was opened  with  the  OPEN
  4919.          command, either  its /A  or /W  switch must  have been  used so that
  4920.          write access will be allowed.
  4921.  
  4922.          The text  written can  be made up of any combination of literal text
  4923.          and/or   user    variables.      Unlike   the   WRITE   command,   a
  4924.          Carriage Return/Line-Feed sequence  is  not  appended  to  the  text
  4925.          written.    The  output  text  starts  with  the  first  significant
  4926.          character following  the file  number (other than a trailing comma).
  4927.          Tabs and spaces are not considered significant.
  4928.  
  4929.          This command  would normally  be used  for writing  to binary  files
  4930.          instead of text files.
  4931.  
  4932.          See also:  CREATE, OPEN, READB, WRITE, CLOSE, %FP
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.                                           77
  4972.  
  4973.  
  4974.                                                    Macro Language - Variables
  4975.        ----------------------------------------------------------------------
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.                                   Macro VariablesMacro Variables
  4982.  
  4983.        Macro variables are the heart of building intelligence into your macro
  4984.        keys.   They allow  you to  build macros  that react  to what  file is
  4985.        currently  selected   or  tagged   files,  save   working  values,  do
  4986.        arithmetic, and so on....
  4987.  
  4988.        If the  file handler  is active  and a  macro key is invoked while the
  4989.        currently selected  file is named "MYLIFE.DOC", consider the following
  4990.        example of how the %FN and %FE variables would expand:
  4991.  
  4992.               Macro Text             Becomes
  4993.             ,------------,      ,-----------------,
  4994.             |  word %fn  |----» |  word MYLIFE    |
  4995.             `------------'      `-----------------'
  4996.  
  4997.             ,------------,      ,-----------------,
  4998.             |  wp %fe    |----» |  wp MYLIFE.DOC  |
  4999.             `------------'      `-----------------'
  5000.  
  5001.        Any type  of  macro  variable  always  begins  with  a  "%"  (percent)
  5002.        character.   Whenever a  percent character  is encountered,  the macro
  5003.        engine expects  it to  be the  start of a variable and will attempt to
  5004.        expand it  into something.   The  only exception  is when  two percent
  5005.        characters are  used back-to-back,  in this case no variable expansion
  5006.        is attempted,  and only  one of  the percent  characters  is  actually
  5007.        passed through.   If  you are  running a  program and  need to  pass a
  5008.        percent character  through to  the program, be sure to use two percent
  5009.        characters in sequence.
  5010.  
  5011.        Macro variable  names are  not case  sensitive (as  usual).   You  can
  5012.        define a user variable in upper case and refer to it later on in lower
  5013.        case.
  5014.  
  5015.        Macro variable  names are not recognized unless they are terminated by
  5016.        an invalid  name character.   An  invalid name  character is  anything
  5017.        that's not  alphabetical except  the underscore.   This eliminates the
  5018.        opportunity for  mis-evaluation of  variable names which might not yet
  5019.        be defined.   For  instance, if  a  variable  called  %TEST  had  been
  5020.        defined, trying  to access it as %TESTING will not work to produce the
  5021.        value of %TEST+"ING" - it will return a null value unless %TESTING has
  5022.        also been defined.
  5023.  
  5024.        If  you   need  to  express  a  variable  name  directly  followed  by
  5025.        alphabetical characters,  enclose the variable name in parenthesis (in
  5026.        which case  both of  the parenthesis  will be  dropped).  For example,
  5027.        "(%TEST)ING will  result in the value of %TEST+"ING".  If you actually
  5028.        want to use a variable inside parenthesis, use two sets of parenthesis
  5029.        on both sides.
  5030.  
  5031.  
  5032.                                           78
  5033.  
  5034.  
  5035.                                                    Macro Language - Variables
  5036.        ----------------------------------------------------------------------
  5037.  
  5038.  
  5039.  
  5040.        There are  three types  of macro variables; user, system, and equates.
  5041.        User variables  and system  variables are  described in  the  upcoming
  5042.        sections.   Equate variables are described under the [EQUATES] section
  5043.        on page 22.
  5044.  
  5045.        User variables  are variables  you can  assign values  to during macro
  5046.        execution, which  can be  changed again  and again  as macro execution
  5047.        progresses.
  5048.  
  5049.        System variables  are internal  variables that  contain  values  which
  5050.        return information  internal to  dCOM.   You can't directly modify the
  5051.        value of a system variable.  Some system variables can also be used as
  5052.        functions to  return a  value based  on the  parameters you supply it.
  5053.        For instance,  one system  variable, %SS(), returns a substring of the
  5054.        string passed to it.
  5055.  
  5056.        Equate variables  are static  variables which  can only  be set  once.
  5057.        They are  useful for defining the value of something once at the start
  5058.        of a  macro, so  you don't have to go searching through the macro at a
  5059.        later point if you want to change it.
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.                                           79
  5094.  
  5095.  
  5096.                                               Macro Language - User Variables
  5097.        ----------------------------------------------------------------------
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.                                    User VariablesUser Variables
  5104.  
  5105.        User  variables  are  variables  created  and  assigned  during  macro
  5106.        execution.   Their names  can be  whatever you  feel like calling them
  5107.        within a  certain set  of rules.   You  can use as many different user
  5108.        variables as necessity dictates.
  5109.  
  5110.        dCOM maintains  a special  memory buffer  to hold user variables.  The
  5111.        total size  of all  user variable  names and  their current values can
  5112.        total as large as 64k.
  5113.  
  5114.        There are  two types  of user  variables, temporary  and permanent.  A
  5115.        temporary user variable lives as long as the macro engine is executing
  5116.        macro code.   The  minute it  stops and  control returns to either the
  5117.        menu mode  or file  handler, all  temporary user variables are deleted
  5118.        from the  memory buffer.   A permanent user variable remains in memory
  5119.        for as long as dCOM is running.
  5120.  
  5121.        Permanent user  variables begin  with a "%@" sequence and are good for
  5122.        such things  as holding  configuration options  in a  menu system,  or
  5123.        anything that  needs to  'live' for a long period of time.  The use of
  5124.        permanent variables  should be very judicious.  Once set, they consume
  5125.        memory across  the duration  of  time  that  dCOM  is  active  (unless
  5126.        expanded memory is present).
  5127.  
  5128.        Temporary user  variables begin  with just  a percent character.  They
  5129.        are good  for holding  keyboard  responses,  interim  working  values,
  5130.        etc...   Since they  are automatically  deleted from memory when macro
  5131.        execution terminates,  most of  what you do with user variables should
  5132.        be done using temporary variables.
  5133.  
  5134.        User variable  names are  limited to the characters of A..Z, 0..9, and
  5135.        the underscore.   user  variables cannot be named the same as a system
  5136.        variable.   If this  happens accidentally,  an Illegal  Variable  Name
  5137.        error will occur during runtime.
  5138.  
  5139.        Example usages are:
  5140.  
  5141.        ,---------------------------------------------------------------------,
  5142.                TEMPORARY VARIABLES             PERMANENT VARIABLES       |                                                                     |
  5143.        |---------------------------------------------------------------------|
  5144.          %DATA_DIR %DATA_DIR=C:\DATA                  %@MENU_COLS%@MENU_COLS=15,1,11,14,2       |                                  |                                  |
  5145.          GETW %FILENAME%FILENAME,13,Enter File:      MENUCOLOR %@MENU_COLS%@MENU_COLS       |                                  |                                  |
  5146.          ADD %TOTAL%TOTAL,100                     %@LOGIN_TIME%@LOGIN_TIME=%TI       |                                  |                                  |
  5147.        `---------------------------------------------------------------------'
  5148.  
  5149.        For debugging  purposes, a  macro command  called VLIST  is  provided,
  5150.        which can  be imbedded  at strategic  points in  macro code so you can
  5151.        view the current values of all user variables.
  5152.  
  5153.  
  5154.                                           80
  5155.  
  5156.  
  5157.                                               Macro Language - User Variables
  5158.        ----------------------------------------------------------------------
  5159.  
  5160.  
  5161.  
  5162.  
  5163.  
  5164.                            Using User Variables as ArraysUsing User Variables as Arrays
  5165.  
  5166.        User variables  can be  used in  a rudimentary  form as  an  array  by
  5167.        following the  variable name  with a  pair  of  square  brackets  that
  5168.        enclose the index.
  5169.  
  5170.        This is  not a  true array  logic though  where only  one variable  is
  5171.        dimensioned.  Each array element is actually defined individually as a
  5172.        separate user variable.
  5173.  
  5174.        There is  no way to get a count of variables that have been defined as
  5175.        array elements  in this  fashion, like  you could  with a  high  level
  5176.        language.  You must manage that yourself using another variable.
  5177.  
  5178.        Spaces used  inside the square brackets are significant.  If you set a
  5179.        variable like  this; "%TEST[ 2 ]",  you must reference it like that in
  5180.        all other parts of the macro definition.
  5181.  
  5182.        This capability, though limited, can still be quite useful.
  5183.  
  5184.        For example:
  5185.  
  5186.        ,---------------------------------------------------------------------,
  5187.         [F1] ARRAY EXAMPLE                     ;;TITLE LINE AND SWITCHES       |                                                                     |
  5188.              %TEST[1]=Testing One              ;;SET 1ST ARRAY ELEMENT       |                                                                     |
  5189.              %TEST[2]=Testing Two              ;;SET 2ND ARRAY ELEMENT       |                                                                     |
  5190.              %MAXINDEX=2                       ;;SET MAX ARRAYS DEFINED       |                                                                     |
  5191.              %CNT=0                            ;;RESET COUNTER       |                                                                     |
  5192.              DO WHILE %CNT<%MAXINDEX           ;;DO WHILE CNT .LT. ELEMENTS       |                                                                     |
  5193.                ADD %CNT,1                      ;; INCREMENT THE COUNTER       |                                                                     |
  5194.                ECHO Array %CNT: %TEST[%CNT]    ;; DISPLAY CURRENT ELEMENT       |                                                                     |
  5195.              ENDDO                             ;;END OF DO WHILE BLOCK       |                                                                     |
  5196.        `---------------------------------------------------------------------'
  5197.  
  5198.  
  5199.  
  5200.                                 Indirect AssignmentsIndirect Assignments
  5201.  
  5202.        User variables  can also  be set  (assigned) indirectly.    Indirectly
  5203.        means that  the name  of the  variable being  set is determined by the
  5204.        value of  another variable.   This  is done  by enclosing the variable
  5205.        being set in parenthesis.  For example:
  5206.  
  5207.        ,---------------------------------------------------------------------,
  5208.         %TEST1=%%TEST2                         ;; %TEST1 = "%TEST2"       |                                                                     |
  5209.         (%TEST1)=Testing                       ;; %TEST2 = "Testing"       |                                                                     |
  5210.        `---------------------------------------------------------------------'
  5211.  
  5212.  
  5213.  
  5214.  
  5215.                                           81
  5216.  
  5217.  
  5218.                                             Macro Language - System Variables
  5219.        ----------------------------------------------------------------------
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225.                                   System VariablesSystem Variables
  5226.  
  5227.        System variables  are not variables you can set with a value, at least
  5228.        not directly.   They  are variables  which return items of information
  5229.        that you  may want  to test on, or use as part of a command to pass to
  5230.        another program.   For instance, %FE returns the name of the currently
  5231.        selected file  if the  file handler  is active,  and %TI  returns  the
  5232.        current time.
  5233.  
  5234.        A few  of the  variables in  this section aren't really variables, but
  5235.        are more  like flags.   When  you use  them like a variable they don't
  5236.        expand into  anything, instead, they set an internal flag in the macro
  5237.        engine.   For example,  the %XM  system variable  doesn't  return  any
  5238.        value, what  it does  is it  tells dCOM to swap itself out to expanded
  5239.        memory or  disk the  next time  it runs  an external program.  Another
  5240.        example is  %W (this  is the  only single character system variable by
  5241.        the way), which tells dCOM to display the pause message when the macro
  5242.        key terminates  (sort of  like using the /W title line switch, but you
  5243.        can use it conditionally).
  5244.  
  5245.  
  5246.  
  5247.                                System Variable IndexSystem Variable Index
  5248.  
  5249.           %(###)%(###)    Untypeable Character................................84
  5250.           %[var]%[var]    Environment Variable................................84
  5251.           %var%%var%     Environment Variable................................84
  5252.           %AT()%AT()     Search String Function..............................85
  5253.           %C1..%C3%C1..%C3  Miscellaneous Counters..............................85
  5254.           %CC%CC       Current Cursor Column...............................86
  5255.           %CD()%CD()     Current Directory...................................86
  5256.           %CL%CL       Current Cursor Line.................................86
  5257.           %DD%DD       Default Drive.......................................86
  5258.           %DE%DE       Current DO Filename and Extension...................87
  5259.           %DF()%DF()     Date of File........................................86
  5260.           %DN%DN       Current DO Filename (no extension)..................87
  5261.           %DP%DP       dCOM's Home Directory (path)........................87
  5262.           %DS%DS       Current DO File Size................................87
  5263.           %DT%DT       Current System Date.................................87
  5264.           %DV%DV       dCOM's Version Number...............................88
  5265.           %DW%DW       Day of Week.........................................88
  5266.           %EL%EL       Last Error Level....................................88
  5267.           %ET%ET       Error Text in an Error Handler......................88
  5268.           %EX()%EX()     Recursive Expansion Function........................89
  5269.           %FA()%FA()     File Attributes.....................................89
  5270.           %FC()%FC()     Format with Commas Function.........................90
  5271.           %FD()%FD()     Free Disk Space on a Drive..........................90
  5272.           %FE%FE       Currently Selected Filename and Extension...........90
  5273.           %FM%FM       Free Memory.........................................90
  5274.  
  5275.  
  5276.                                           82
  5277.  
  5278.  
  5279.                                             Macro Language - System Variables
  5280.        ----------------------------------------------------------------------
  5281.  
  5282.  
  5283.           %FN%FN       Currently Selected Filename (no extension)..........90
  5284.           %FP()%FP()     Current File Position of an Open File...............91
  5285.           %KB%KB       Current Keyboard Character..........................91
  5286.           %LC()%LC()     Convert to Lower Case Function......................91
  5287.           %LD%LD       Login Drive (1st Network Drive).....................92
  5288.           %LE%LE       Error Line Number in an Error Handler...............92
  5289.           %LN%LN       Login Name (dCOM's Access Control System)...........92
  5290.           %MM%MM       Memory Mode Active Flag.............................92
  5291.           %MY%MY       Month of Year.......................................92
  5292.           %OD%OD       Original Drive Macro Ran From.......................93
  5293.           %OS%OS       Original Subdirectory Macro Ran From................93
  5294.           %P1..%P9%P1..%P9  Parameters Passed to a Subroutine...................93
  5295.           %RJ()%RJ()     Right Justifies a String............................93
  5296.           %RT()%RT()     Search String Function (from right to left).........94
  5297.           %SC%SC       Selection Count from SELECT.........................94
  5298.           %SE%SE       Selected Filename & Extension from SELECT...........95
  5299.           %SF()%SF()     Size of File........................................94
  5300.           %SL()%SL()     String Length Function..............................94
  5301.           %SN%SN       Selected Filename (no extension) from SELECT........95
  5302.           %SP%SP       Path of Selected File from SELECT /P................95
  5303.           %SS()%SS()     Substring Function..................................95
  5304.           %TC%TC       Count of Tagged Files...............................96
  5305.           %TD()%TD()     Total Disk Space on Drive...........................96
  5306.           %TE%TE       Tagged Filename and Extension in LOOP...............96
  5307.           %TI%TI       Current System Time.................................97
  5308.           %TL()%TL()     Trim String From Left Function......................97
  5309.           %TN%TN       Tagged Filename (no extension) in LOOP..............96
  5310.           %TR()%TR()     Trim String From Right Function.....................97
  5311.           %UC()%UC()     Convert to Upper Case Function......................97
  5312.           %VL()%VL()     Volume Label of Drive...............................97
  5313.           %W%W        Set Pause Flag When Macro Terminates Flag...........97
  5314.           %W1..%W4%W1..%W4  Current dimensions of WINDOW........................98
  5315.           %WD()%WD()     Returns a Binary Word Using Numeric Text............98
  5316.           %WT()%WT()     Returns Numeric Text Using a Binary Word............98
  5317.           %XC()%XC()     Repeat Character Function...........................99
  5318.           %XM%XM       Extra Memory When Running Program Flag..............99
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.                                           83
  5338.  
  5339.  
  5340.                                    Macro Language - System Variable Reference
  5341.        ----------------------------------------------------------------------
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.                              System Variable ReferenceSystem Variable Reference
  5348.  
  5349.        ,---------------------------------------------------------------------,
  5350.          %(###)%(###)       |                                                                     |
  5351.        `---------------------------------------------------------------------'
  5352.          Generates an untypeable ASCII character.
  5353.  
  5354.          This could  be handy for sending printer codes, etc....  There is no
  5355.          requirement to provide three digits if only one or two are needed.
  5356.  
  5357.          Other user or system variables may be embedded inside this variable.
  5358.  
  5359.          See also:  %WD
  5360.  
  5361.          Example:
  5362.  
  5363.              [F1] COMPRESSED PITCH   ;;TITLE LINE AND SWITCHES
  5364.              PRINTSTR %(15)%(15)          ;;SET EPSON PRINTER TO COMPRESSED
  5365.  
  5366.  
  5367.        ,---------------------------------------------------------------------,
  5368.          %[var]%[var]       |                                                                     |
  5369.        `---------------------------------------------------------------------'
  5370.          Returns the current contents of an environment variable.
  5371.  
  5372.          This method  of accessing  an environment variable is preferred over
  5373.          the method described next (%var%), because its syntax is potentially
  5374.          less confusing  to the  macro engine, and it also reliably returns a
  5375.          null value if the environment variable is undefined.
  5376.  
  5377.          You may often need to access the contents of an environment variable
  5378.          so you can save it before modifying it, or for some other reason.
  5379.  
  5380.          See also:  %var%
  5381.  
  5382.          Example:
  5383.  
  5384.              [F1] MS-WORD                 ;;TITLE LINE AND SWITCHES
  5385.              %OLDPATH=%[PATH]%[PATH]             ;;SAVE CURRENT PATH IN %OLDPATH
  5386.              SET PATH=C:\WORD;%[PATH]%[PATH]     ;;REVISE IT TO INCLUDE C:\WORD
  5387.              WORD                         ;;RUN MS-WORD FROM PATH
  5388.              SET PATH=%OLDPATH            ;;RESTORE PATH TO ORIG CONTENTS
  5389.  
  5390.  
  5391.        ,---------------------------------------------------------------------,
  5392.          %var%%var%       |                                                                     |
  5393.        `---------------------------------------------------------------------'
  5394.          Returns the current contents of an environment variable.
  5395.  
  5396.  
  5397.  
  5398.                                           84
  5399.  
  5400.  
  5401.                                    Macro Language - System Variable Reference
  5402.        ----------------------------------------------------------------------
  5403.  
  5404.  
  5405.          This method  of accessing  an environment variable has been replaced
  5406.          by the  %[var] method,  but is  still provided  for  backward  macro
  5407.          compatibility and batch file compatibility.
  5408.  
  5409.          Use of  this method  to access  an environment  variable  should  be
  5410.          changed to the "%[var]" method wherever possible.  The reason why is
  5411.          that if  any part  of the environment variable expressed matches the
  5412.          name of  a user  variable, the user variable will be returned first.
  5413.          For example,  if %PA  were set  as a user variable, trying to access
  5414.          the path as %PATH% would return the value of %PA+"TH".
  5415.  
  5416.          See also:  %[var]
  5417.  
  5418.  
  5419.        ,---------------------------------------------------------------------,
  5420.          %AT%AT(searchstring,sourcestring[,start])       |                                                                     |
  5421.        `---------------------------------------------------------------------'
  5422.          Searches the  "sourcestring" for "searchstring" starting at position
  5423.          "start".
  5424.  
  5425.          This variable  provides  a  mechanism  to  search  a  string  for  a
  5426.          substring.   If the  substring is  found, its  starting position  is
  5427.          returned, otherwise zero is returned.
  5428.  
  5429.          The search  performed is  case-insensitive (what's new), moving from
  5430.          left to  right.   If the  starting position  isn't given, the search
  5431.          begins with the first character of the "sourcestring".
  5432.  
  5433.          See also:  %SS, %RT
  5434.  
  5435.          Example:
  5436.  
  5437.              ECHO %AT(STING,TESTING) ;;DISPLAYS A "2"
  5438.  
  5439.  
  5440.        ,---------------------------------------------------------------------,
  5441.          %C1..%C3%C1..%C3       |                                                                     |
  5442.        `---------------------------------------------------------------------'
  5443.          The use of these variables is rather advanced and obscure.  They are
  5444.          described  mainly   in  the   interest  of  indicating  all  options
  5445.          available.
  5446.  
  5447.          %C1 and  %C2 indicate the number of times a [FILEAUTO] or [MENUAUTO]
  5448.          (respectively) have run since macro execution started.
  5449.  
  5450.          %C3 returns  the number  of times  the  RUNMACRO  command  has  been
  5451.          executed since macro execution started.
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.                                           85
  5460.  
  5461.  
  5462.                                    Macro Language - System Variable Reference
  5463.        ----------------------------------------------------------------------
  5464.  
  5465.  
  5466.        ,---------------------------------------------------------------------,
  5467.          %CC%CC       |                                                                     |
  5468.        `---------------------------------------------------------------------'
  5469.          Returns the  current cursor  column.   If this  variable is accessed
  5470.          before the  screen is  initially cleared, an erroneous value will be
  5471.          returned.
  5472.  
  5473.          See also:  %CL
  5474.  
  5475.  
  5476.        ,---------------------------------------------------------------------,
  5477.          %CD%CD       |                                                                     |
  5478.          %CD%CD(d:)       |                                                                     |
  5479.        `---------------------------------------------------------------------'
  5480.          Returns the current directory of the default drive (i.e. "\word", or
  5481.          "\"), or the current directory of the drive specified.
  5482.  
  5483.          A trailing  backslash should  always be used with this variable when
  5484.          combining it  with other  variables  or  text  to  form  a  complete
  5485.          pathspec.    If  the  current  directory  happens  to  be  the  root
  5486.          directory, the  macro engine  will  automatically  ensure  that  two
  5487.          backslashes aren't produced by the combination of "%CD\text".
  5488.  
  5489.          See also:  %OS
  5490.  
  5491.  
  5492.        ,---------------------------------------------------------------------,
  5493.          %CL%CL       |                                                                     |
  5494.        `---------------------------------------------------------------------'
  5495.          Returns the  current cursor  line.   If this  variable  is  accessed
  5496.          before the  screen is  initially cleared, an erroneous value will be
  5497.          returned.
  5498.  
  5499.          See also:  %CC
  5500.  
  5501.  
  5502.        ,---------------------------------------------------------------------,
  5503.          %DD%DD       |                                                                     |
  5504.        `---------------------------------------------------------------------'
  5505.          Returns the current default drive (i.e. "C:").
  5506.  
  5507.          See also:  %LD, %OD
  5508.  
  5509.  
  5510.        ,---------------------------------------------------------------------,
  5511.          %DF%DF([d:][path]filename)       |                                                                     |
  5512.        `---------------------------------------------------------------------'
  5513.          Returns the date and time stamp of a file as: "MM-DD-YY HH:MM:SS".
  5514.  
  5515.          If you  are only  interested in  just date  or time,  use  %SS()  to
  5516.          isolate that portion.
  5517.  
  5518.  
  5519.  
  5520.                                           86
  5521.  
  5522.  
  5523.                                    Macro Language - System Variable Reference
  5524.        ----------------------------------------------------------------------
  5525.  
  5526.  
  5527.          See also:  %SF
  5528.  
  5529.  
  5530.        ,---------------------------------------------------------------------,
  5531.          %DN%DN       |                                                                     |
  5532.          %DE%DE       |                                                                     |
  5533.        `---------------------------------------------------------------------'
  5534.          Within a  DO loop,  expands into the current iteration's filename or
  5535.          filename and extension (respectively).
  5536.  
  5537.          Using these  variables in  a DO  block lets  you build macro keys to
  5538.          handle multiple  files that  have something  in  common  (i.e.  .BAK
  5539.          files).
  5540.  
  5541.          See also:  DO, %DS
  5542.  
  5543.  
  5544.        ,---------------------------------------------------------------------,
  5545.          %DP%DP       |                                                                     |
  5546.        `---------------------------------------------------------------------'
  5547.          Returns the  drive and  path from  which  dCOM  was  run  (the  Home
  5548.          Directory).
  5549.  
  5550.          A trailing  backslash should  always be used with this variable when
  5551.          combining it  with other  variables  or  text  to  form  a  complete
  5552.          pathspec.    If  dCOM's  home  directory  happens  to  be  the  root
  5553.          directory, the  macro engine  will  automatically  ensure  that  two
  5554.          backslashes aren't produced by the combination of "%DP\text".
  5555.  
  5556.          See also:  %CD, %DV, %OS
  5557.  
  5558.  
  5559.        ,---------------------------------------------------------------------,
  5560.          %DS%DS       |                                                                     |
  5561.        `---------------------------------------------------------------------'
  5562.          Within a DO loop, expands into the current iteration's filesize.
  5563.  
  5564.          See also:  DO, %DE, %DN
  5565.  
  5566.  
  5567.        ,---------------------------------------------------------------------,
  5568.          %DT%DT       |                                                                     |
  5569.        `---------------------------------------------------------------------'
  5570.          Returns the current system date in the format: YY-MM-DD.
  5571.  
  5572.          See also:  %DF, %TI
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.                                           87
  5582.  
  5583.  
  5584.                                    Macro Language - System Variable Reference
  5585.        ----------------------------------------------------------------------
  5586.  
  5587.  
  5588.        ,---------------------------------------------------------------------,
  5589.          %DV%DV       |                                                                     |
  5590.        `---------------------------------------------------------------------'
  5591.          Returns dCOM's  version number  as text  in integer  form without  a
  5592.          period separating  the major  version number  from the minor version
  5593.          number.   This allows it to be tested in an IF statement using less-
  5594.          than or greater-than operators.
  5595.  
  5596.          See also:  %DP
  5597.  
  5598.          Example:
  5599.  
  5600.              IF %DV<362 THEN              ;;IF DCOM'S VER IS TOO OLD
  5601.                BEEP                       ;; BEEP SPEAKER
  5602.                MENU dCOM Ver is Too Old   ;; DISPLAY ERROR MESSAGE
  5603.                 .Press Return to Continue ;;  USING MENU COMMAND
  5604.                EXIT                       ;; TERMINATE MACRO EXECUTION
  5605.              ENDIF                        ;;END OF IF BLOCK
  5606.  
  5607.  
  5608.        ,---------------------------------------------------------------------,
  5609.          %DW%DW       |                                                                     |
  5610.        `---------------------------------------------------------------------'
  5611.          Returns the day of week (Monday, Tuesday, etc...).
  5612.  
  5613.          See also:  %MY
  5614.  
  5615.  
  5616.        ,---------------------------------------------------------------------,
  5617.          %EL%EL       |                                                                     |
  5618.        `---------------------------------------------------------------------'
  5619.          Returns the error level returned by the last program executed.
  5620.  
  5621.          This variable  is also  updated  by  several  macro  commands  (i.e.
  5622.          QFORMAT), and  it also  holds the  macro internal error number if an
  5623.          error handling routine is called because of an ONERRORGOTO trap.
  5624.  
  5625.          See also:  %ET, %LE, ONERRORGOTO
  5626.  
  5627.  
  5628.        ,---------------------------------------------------------------------,
  5629.          %ET%ET       |                                                                     |
  5630.        `---------------------------------------------------------------------'
  5631.          If an  error handling  routine is  active because  of an ONERRORGOTO
  5632.          trap, this  variable returns  the error  text describing  the actual
  5633.          error that occurred.
  5634.  
  5635.          See also:  %EL, %LE, ONERRORGOTO
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.                                           88
  5643.  
  5644.  
  5645.                                    Macro Language - System Variable Reference
  5646.        ----------------------------------------------------------------------
  5647.  
  5648.  
  5649.        ,---------------------------------------------------------------------,
  5650.          %EX%EX(text)       |                                                                     |
  5651.        `---------------------------------------------------------------------'
  5652.          Performs a  secondary recursive  expansion on the text passed as the
  5653.          parameter.   This allows  a macro  variable to  contain the  name of
  5654.          another macro variable, and have the second macro variable expanded.
  5655.          This might be useful for something like imbedding macro variables in
  5656.          a text file and having them expanded when displayed.
  5657.  
  5658.          Example:
  5659.  
  5660.                                           ;;  Text Displayed
  5661.                                           ;;------------------------------
  5662.              %TEXT=Today's Date: %%DT     ;;  <nothing>
  5663.              ECHO %TEXT                   ;;  Today's Date: %DT
  5664.              ECHO %EX(%TEXT)              ;;  Today's Date: 07-17-99
  5665.  
  5666.  
  5667.        ,---------------------------------------------------------------------,
  5668.          %FA%FA       |                                                                     |
  5669.          %FA%FA([d:][path]filename)       |                                                                     |
  5670.        `---------------------------------------------------------------------'
  5671.          Returns the attributes of a file or directory.
  5672.  
  5673.          If the  filespec parameter  isn't given,  the attributes of the file
  5674.          handler's currently selected file or directory are returned.
  5675.  
  5676.          This variable  always returns  a five  character  string  with  each
  5677.          position representing  whether a  particular flag  is set.  They are
  5678.          defined as follows:
  5679.  
  5680.             A----     Archive
  5681.             -D---     Directory
  5682.             --S--     System
  5683.             ---H-     Hidden
  5684.             ----R     Read-Only
  5685.  
  5686.          Since  its   possible  for   more  than  one  attribute  to  be  set
  5687.          simultaneously, its  not a  good idea  to be  testing on  any one of
  5688.          these values  explicitly.  Instead, use the %AT() function to search
  5689.          for the attribute you are interested in.
  5690.  
  5691.          See also:  %SF, %DF
  5692.  
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.                                           89
  5704.  
  5705.  
  5706.                                    Macro Language - System Variable Reference
  5707.        ----------------------------------------------------------------------
  5708.  
  5709.  
  5710.          Example:
  5711.  
  5712.              IF %AT(D,%FA)>0 THEN              ;;IF CURRENTLY SEL'D IS A DIR
  5713.                BEEP                            ;; BEEP SPEAKER
  5714.                MENU Macro Won't Work on Dirs   ;; DISPLAY ERROR MESSAGE
  5715.                 .Press Return to Continue      ;;  USING MENU COMMAND
  5716.                EXIT                            ;; TERMINATE MACRO EXECUTION
  5717.              ENDIF                             ;;END OF IF BLOCK
  5718.  
  5719.  
  5720.        ,---------------------------------------------------------------------,
  5721.          %FC%FC(string)       |                                                                     |
  5722.        `---------------------------------------------------------------------'
  5723.          Returns a  string formatted  with commas inserted every 3 characters
  5724.          from the  right.   Normally the  string would be a numeric variable,
  5725.          but %FC  doesn't particularly  care whether  the parameter  given is
  5726.          actually a number.
  5727.  
  5728.          Example:
  5729.  
  5730.              ECHO %FC(%TD(C:))       ;;DISPLAY TOTAL DISK SPACE ON C:
  5731.  
  5732.  
  5733.        ,---------------------------------------------------------------------,
  5734.          %FD%FD       |                                                                     |
  5735.          %FD%FD(d:)       |                                                                     |
  5736.        `---------------------------------------------------------------------'
  5737.          Returns the  free disk  space of the default drive, or the free disk
  5738.          space of the drive specified.
  5739.  
  5740.          See also:  %TD, %VL
  5741.  
  5742.  
  5743.        ,---------------------------------------------------------------------,
  5744.          %FM%FM       |                                                                     |
  5745.        `---------------------------------------------------------------------'
  5746.          Returns the  amount of  free memory  available to external programs.
  5747.          The algorithm  used to  calculate this  value is less extensive than
  5748.          the one  used in  the file  handler, so  its value  may be off by 16
  5749.          bytes or so here or there.
  5750.  
  5751.          %FM can't  and doesn't  account for  the extra  memory that would be
  5752.          released if a program is run with %XM active.
  5753.  
  5754.  
  5755.        ,---------------------------------------------------------------------,
  5756.          %FN%FN       |                                                                     |
  5757.          %FE%FE       |                                                                     |
  5758.        `---------------------------------------------------------------------'
  5759.          Expands into  the  currently  selected  filename  or  the  currently
  5760.          selected filename and its extension (respectively).
  5761.  
  5762.  
  5763.  
  5764.                                           90
  5765.  
  5766.  
  5767.                                    Macro Language - System Variable Reference
  5768.        ----------------------------------------------------------------------
  5769.  
  5770.  
  5771.          A runtime  error will  result if these variables are used in a macro
  5772.          definition that  is executed  while the  menu  mode  is  active  (/M
  5773.          command line switch).
  5774.  
  5775.          Using these  variables in  a macro  command lets  you build your own
  5776.          point-n-shoot macro commands.
  5777.  
  5778.          See also:  %TN, %TE
  5779.  
  5780.  
  5781.        ,---------------------------------------------------------------------,
  5782.          %FP%FP([#]filenumber)       |                                                                     |
  5783.        `---------------------------------------------------------------------'
  5784.          Returns the  current file  position pointer of a file using the file
  5785.          number that was opened with OPEN or CREATE.
  5786.  
  5787.  
  5788.        ,---------------------------------------------------------------------,
  5789.          %KB%KB       |                                                                     |
  5790.        `---------------------------------------------------------------------'
  5791.          Returns a  keyboard character  if one  is waiting  in  the  keyboard
  5792.          buffer.
  5793.  
  5794.          If no  keyboard character is waiting, a value of %(255) is returned.
  5795.          If the  keyboard character  waiting is  an ASCII 0 (used as a escape
  5796.          character when  some  extended  keys  like  the  function  keys  are
  5797.          pressed), it will be translated to a %(254).
  5798.  
  5799.          Normally you  set a  user variable  with the  value of %KB, and then
  5800.          perform tests on the user variable.  This is because whenever %KB is
  5801.          referenced and  a keyboard  character is  waiting, the  character is
  5802.          then pulled  out of  the keyboard  queue.   An immediate  subsequent
  5803.          reference to  %KB to  perform another  test will  not see  the  same
  5804.          character.   This is  OK if  you only need to test once on its value
  5805.          and then loop back if false, but multiple tests designed to react to
  5806.          different keys  will need  a way  to test more than once on a single
  5807.          character typed.
  5808.  
  5809.          Example:
  5810.  
  5811.              [F1] WAIT FOR ESC OR RET               ;;TITLE LINE AND SWITCHES
  5812.              %KEY=                                  ;;ENSURE %KEY IS RESET
  5813.              DO WHILE %KEY<>%(27) .AND. %KEY<>%(13) ;;DO WHILE NOT ESC OR RET
  5814.                %KEY=%KB                             ;; %KEY=POSSIBLE KEYPRESS
  5815.              ENDDO                                  ;;LOOP IF NOT ESC OR RET
  5816.  
  5817.  
  5818.        ,---------------------------------------------------------------------,
  5819.          %LC%LC(string)       |                                                                     |
  5820.        `---------------------------------------------------------------------'
  5821.          Returns the string converted to lower case.
  5822.  
  5823.  
  5824.  
  5825.                                           91
  5826.  
  5827.  
  5828.                                    Macro Language - System Variable Reference
  5829.        ----------------------------------------------------------------------
  5830.  
  5831.  
  5832.          See also:  %UC
  5833.  
  5834.  
  5835.        ,---------------------------------------------------------------------,
  5836.          %LD%LD       |                                                                     |
  5837.        `---------------------------------------------------------------------'
  5838.          Returns the  first remote  drive found.   On  a Novell network, this
  5839.          will be  the login drive if the user is not currently logged in.  If
  5840.          no remote drives are found, %LD returns null.
  5841.  
  5842.  
  5843.        ,---------------------------------------------------------------------,
  5844.          %LE%LE       |                                                                     |
  5845.        `---------------------------------------------------------------------'
  5846.          If an  error handling  routine is  active because  of an ONERRORGOTO
  5847.          trap, this variable returns the error line number in the souce macro
  5848.          file.
  5849.  
  5850.          This value  is unreliable  if the  error occured during execution of
  5851.          macro code that was imported with an INCLUDE command.
  5852.  
  5853.          See also:  %EL, %ET, ONERRORGOTO
  5854.  
  5855.  
  5856.        ,---------------------------------------------------------------------,
  5857.          %LN%LN       |                                                                     |
  5858.        `---------------------------------------------------------------------'
  5859.          Returns the  current user's  login name  under  the  access  control
  5860.          system.  If the access control system isn't active, the current user
  5861.          is considered the supervisor.
  5862.  
  5863.  
  5864.        ,---------------------------------------------------------------------,
  5865.          %MM%MM       |                                                                     |
  5866.        `---------------------------------------------------------------------'
  5867.          Returns a  bolean value  indicating whether the menu mode is active.
  5868.          If the  menu mode is active, a non-zero value is returned, otherwise
  5869.          zero is returned.
  5870.  
  5871.          See also:  MACROMENU
  5872.  
  5873.  
  5874.        ,---------------------------------------------------------------------,
  5875.          %MY%MY       |                                                                     |
  5876.        `---------------------------------------------------------------------'
  5877.          Returns the month of year (January, February, etc...).
  5878.  
  5879.          See also:  %DW
  5880.  
  5881.  
  5882.  
  5883.  
  5884.  
  5885.  
  5886.                                           92
  5887.  
  5888.  
  5889.                                    Macro Language - System Variable Reference
  5890.        ----------------------------------------------------------------------
  5891.  
  5892.  
  5893.        ,---------------------------------------------------------------------,
  5894.          %OD%OD       |                                                                     |
  5895.        `---------------------------------------------------------------------'
  5896.          Returns the  original drive which was the default when the macro key
  5897.          was first invoked.
  5898.  
  5899.          See also:  %DD
  5900.  
  5901.  
  5902.        ,---------------------------------------------------------------------,
  5903.          %OS%OS       |                                                                     |
  5904.        `---------------------------------------------------------------------'
  5905.          Returns the  original subdirectory  which was  the current directory
  5906.          when the macro key was first invoked.
  5907.  
  5908.          A trailing  backslash should  always be used with this variable when
  5909.          combining it  with other  variables  or  text  to  form  a  complete
  5910.          pathspec.   If the  original subdirectory  happens to  be  the  root
  5911.          directory, the  macro engine  will  automatically  ensure  that  two
  5912.          backslashes aren't  produced by  say the combination of "%OD%OS\%FE"
  5913.          (the full pathspec to the originally selected file).
  5914.  
  5915.          See also:  %CD
  5916.  
  5917.  
  5918.        ,---------------------------------------------------------------------,
  5919.          %P1..%P9%P1..%P9       |                                                                     |
  5920.        `---------------------------------------------------------------------'
  5921.          Returns the value of a parameter passed to the current subroutine or
  5922.          macro file.
  5923.  
  5924.          Both the  GOSUB and GOSUBMF commands allow arguments to be passed to
  5925.          the called procedure or macro file using a parameter list surrounded
  5926.          in parenthesis.   Inside  the called  procedure or  macro  file  the
  5927.          parameters are  accessed using  %P1..%P9 (%P1 = the first parameter,
  5928.          %P2 =  the second,  and so  on...).   The values  of %P1..%P9 change
  5929.          dynamically with each level of nesting involved.
  5930.  
  5931.          See also:  GOSUB, GOSUBMF
  5932.  
  5933.  
  5934.        ,---------------------------------------------------------------------,
  5935.          %RJ%RJ(string,length)       |                                                                     |
  5936.        `---------------------------------------------------------------------'
  5937.          Returns the string right justified within the length specified.
  5938.  
  5939.          Spaces are  used to  pad the  left side  of the  string in  order to
  5940.          return a string equal to the length given.
  5941.  
  5942.          If the  string specified  is longer  than the  length specified, the
  5943.          full length of the string is returned.
  5944.  
  5945.  
  5946.  
  5947.                                           93
  5948.  
  5949.  
  5950.                                    Macro Language - System Variable Reference
  5951.        ----------------------------------------------------------------------
  5952.  
  5953.  
  5954.          See also:  %FC, %SL
  5955.  
  5956.          Example:
  5957.  
  5958.              %VAR1=1234              ;;%VAR=1234
  5959.              ECHO %RJ(%VAR1,10)      ;;DISPLAYS "      1234"
  5960.              ECHO %RJ(%FC(%VAR1),10) ;;DISPLAYS "     1,234"
  5961.  
  5962.  
  5963.        ,---------------------------------------------------------------------,
  5964.          %RT%RT(searchstring,sourcestring)       |                                                                     |
  5965.        `---------------------------------------------------------------------'
  5966.          Searches for  "searchstring" in  "sourcestring", starting at the end
  5967.          of "sourcestring".
  5968.  
  5969.          This variable  provides  a  mechanism  to  search  a  string  for  a
  5970.          substring.   If the  substring is  found, its  starting position  is
  5971.          returned, otherwise zero is returned.
  5972.  
  5973.          The search performed is case-insensitive, moving from right to left.
  5974.  
  5975.          See also:  %AT, %SS
  5976.  
  5977.          Example:
  5978.  
  5979.              ECHO %RT(T,TESTING)     ;;DISPLAYS A "4"
  5980.  
  5981.  
  5982.        ,---------------------------------------------------------------------,
  5983.          %SC%SC       |                                                                     |
  5984.        `---------------------------------------------------------------------'
  5985.          Returns the count of files found with the last SELECT command.
  5986.  
  5987.          See also:  %SN, %SE, %SP, SELECT
  5988.  
  5989.  
  5990.        ,---------------------------------------------------------------------,
  5991.          %SF%SF([d:][path]filename)       |                                                                     |
  5992.        `---------------------------------------------------------------------'
  5993.          Returns the size of a file.
  5994.  
  5995.          See also:  %DF
  5996.  
  5997.  
  5998.        ,---------------------------------------------------------------------,
  5999.          %SL%SL(string)       |                                                                     |
  6000.        `---------------------------------------------------------------------'
  6001.          Returns the length of "string".
  6002.  
  6003.          See also:  %AT, %RT, %SS
  6004.  
  6005.  
  6006.  
  6007.  
  6008.                                           94
  6009.  
  6010.  
  6011.                                    Macro Language - System Variable Reference
  6012.        ----------------------------------------------------------------------
  6013.  
  6014.  
  6015.          Examples:
  6016.  
  6017.              %TEXT=TESTING           ;;%TEXT="TESTING"
  6018.              %LEN=%SL(%TEXT)         ;;%LEN=7
  6019.              %LEN=%SL(%SS(%TEXT,3))  ;;%LEN=5
  6020.  
  6021.  
  6022.        ,---------------------------------------------------------------------,
  6023.          %SN%SN       |                                                                     |
  6024.          %SE%SE       |                                                                     |
  6025.        `---------------------------------------------------------------------'
  6026.          Expands  into   the  filename   or  filename   and   its   extension
  6027.          (respectively) that was picked from the last SELECT menu.
  6028.  
  6029.          See also:  %SC, %SP, SELECT
  6030.  
  6031.  
  6032.        ,---------------------------------------------------------------------,
  6033.          %SP%SP       |                                                                     |
  6034.        `---------------------------------------------------------------------'
  6035.          When the  SELECT command  is used  with a /P switch, %SP returns the
  6036.          full path (drive and directory) from which the file (%SN or %SE) was
  6037.          selected.
  6038.  
  6039.          A trailing  backslash should  always be used with this variable when
  6040.          combining it with %SN or %SE to form the full pathspec.  If the path
  6041.          selected happened  to be  the root  directory, the macro engine will
  6042.          automatically ensure  that two  backslashes aren't  produced by  the
  6043.          combination of "%SP\%SE".
  6044.  
  6045.          See also:  %SN, %SE, SELECT
  6046.  
  6047.  
  6048.        ,---------------------------------------------------------------------,
  6049.          %SS%SS(string,start[,length])       |                                                                     |
  6050.        `---------------------------------------------------------------------'
  6051.          Returns a  substring of  "string" starting  at position  "start" for
  6052.          "length" characters.
  6053.  
  6054.          If the  length parameter  is omitted,  the remainder  of the  string
  6055.          beginning at the start position is returned.
  6056.  
  6057.          If the length is specified, but it plus the starting position exceed
  6058.          the length  of "string",  only the  remaining valid  characters  are
  6059.          returned.
  6060.  
  6061.          See also:  %AT, %RT, %SL
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.  
  6069.                                           95
  6070.  
  6071.  
  6072.                                    Macro Language - System Variable Reference
  6073.        ----------------------------------------------------------------------
  6074.  
  6075.  
  6076.          Examples:
  6077.  
  6078.              %TEXT=%SS(TESTING,3)    ;;%TEXT="STING"
  6079.              %TEXT=%SS(%TEXT,2,3)    ;;%TEXT="TIN"
  6080.  
  6081.  
  6082.        ,---------------------------------------------------------------------,
  6083.          %TC%TC       |                                                                     |
  6084.        `---------------------------------------------------------------------'
  6085.          Returns the count of files currently tagged.
  6086.  
  6087.          A runtime  error will  result if  this variable  is used  in a macro
  6088.          definition that  is executed  while the  menu  mode  is  active  (/M
  6089.          command line switch).
  6090.  
  6091.          See also:  %TN, %TE
  6092.  
  6093.  
  6094.        ,---------------------------------------------------------------------,
  6095.          %TD%TD       |                                                                     |
  6096.          %TD%TD(d:)       |                                                                     |
  6097.        `---------------------------------------------------------------------'
  6098.          Returns the total disk space of the default drive, or the total disk
  6099.          space of the drive specified.
  6100.  
  6101.          See also:  %FD, %VL
  6102.  
  6103.  
  6104.        ,---------------------------------------------------------------------,
  6105.          %TN%TN       |                                                                     |
  6106.          %TE%TE       |                                                                     |
  6107.        `---------------------------------------------------------------------'
  6108.          Expands into  the current  iteration's tagged  filename, or filename
  6109.          and extension (respectively), within a LOOP block.
  6110.  
  6111.          A runtime  error will  result if these variables are used in a macro
  6112.          definition that  is executed  while the  menu  mode  is  active  (/M
  6113.          command line switch).
  6114.  
  6115.          If no  files are  tagged in  the file  handler, these variables will
  6116.          return the  currently selected filename (or filename and extension),
  6117.          and the LOOP will only execute for only one iteration.
  6118.  
  6119.          Using these variables in a LOOP block lets you build macro keys that
  6120.          react interactively  with the  file handler,  by processing whatever
  6121.          files are tagged.
  6122.  
  6123.          See also:  %FN, %FE, %TC, LOOP
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.                                           96
  6131.  
  6132.  
  6133.                                    Macro Language - System Variable Reference
  6134.        ----------------------------------------------------------------------
  6135.  
  6136.  
  6137.        ,---------------------------------------------------------------------,
  6138.          %TI%TI       |                                                                     |
  6139.        `---------------------------------------------------------------------'
  6140.          Returns the current system time in the format: HH:MM:SS.
  6141.  
  6142.          See also:  %DT
  6143.  
  6144.  
  6145.        ,---------------------------------------------------------------------,
  6146.          %TR%TR(string)       |                                                                     |
  6147.          %TL%TL(string)       |                                                                     |
  6148.        `---------------------------------------------------------------------'
  6149.          Returns the string trimmed of leading or trailing spaces.
  6150.  
  6151.          %TR trims  the right  edge, %TL trims the left edge.  Generally this
  6152.          is not  necessary for  most macro  operations as  the  macro  engine
  6153.          normally does  it internally,  except for  file I/O  with the READLN
  6154.          command.
  6155.  
  6156.          See also:  %SS
  6157.  
  6158.  
  6159.        ,---------------------------------------------------------------------,
  6160.          %UC%UC(string)       |                                                                     |
  6161.        `---------------------------------------------------------------------'
  6162.          Returns the string converted to upper case.
  6163.  
  6164.          See also:  %LC
  6165.  
  6166.  
  6167.        ,---------------------------------------------------------------------,
  6168.          %VL%VL       |                                                                     |
  6169.          %VL%VL(d:)       |                                                                     |
  6170.        `---------------------------------------------------------------------'
  6171.          Returns the  volume label  of the default drive, or the volume label
  6172.          of the drive specified.
  6173.  
  6174.          See also:  %FD, %TD
  6175.  
  6176.  
  6177.        ,---------------------------------------------------------------------,
  6178.          %W%W       |                                                                     |
  6179.        `---------------------------------------------------------------------'
  6180.          This variable  is actually a flag that tells dCOM to display a pause
  6181.          (wait) message when the macro terminates.  This is the same thing as
  6182.          using the  /W title  line  switch  except  that  %W  can  be  issued
  6183.          conditionally.
  6184.  
  6185.          %W doesn't return anything (its presence in a command line is simply
  6186.          deleted).  Leading or trailing spaces surrounding %W are significant
  6187.          though.
  6188.  
  6189.  
  6190.  
  6191.                                           97
  6192.  
  6193.  
  6194.                                    Macro Language - System Variable Reference
  6195.        ----------------------------------------------------------------------
  6196.  
  6197.  
  6198.  
  6199.        ,---------------------------------------------------------------------,
  6200.          %W1..%W4%W1..%W4       |                                                                     |
  6201.        `---------------------------------------------------------------------'
  6202.          Return the  current text area dimensions of the active WINDOW (start
  6203.          line, start column, end line, and end column - respectively).
  6204.  
  6205.          If no  WINDOW is  active, the  dimensions of  the entire  screen are
  6206.          returned.
  6207.  
  6208.          For   instance,    if   you    had    opened    a    window    using
  6209.          "WINDOW 5,10,20,70...", these variables would return: %W1=6, %W2=12,
  6210.          %W3=19, %W4=69.   Note that all of them except %W2 return a value of
  6211.          one increment  inside the window specified.  The start column (%W2),
  6212.          is automatically  adjusted by  the  WINDOW  command  to  indent  two
  6213.          columns to  allow for  a space  to separate the left border from the
  6214.          text echoed inside the window.
  6215.  
  6216.          These variables  might be  useful in a subroutine that needs to know
  6217.          the boundaries of the active window so it can position the cursor to
  6218.          some location inside the window and display something - and not have
  6219.          to hard-wire the subroutine with the dimensions of the window.
  6220.  
  6221.          See also:  WINDOW
  6222.  
  6223.  
  6224.        ,---------------------------------------------------------------------,
  6225.          %WD%WD(numerictext)       |                                                                     |
  6226.        `---------------------------------------------------------------------'
  6227.          Returns a binary word (2 byte) value for the numeric text specified.
  6228.  
  6229.          About the  only time  you would  need the  function provided by this
  6230.          variable is  if you  need to write the value of an integer word to a
  6231.          binary-type file.   This  is because  the  macro  engine  internally
  6232.          retains all  user variables  as text,  whether they  contain numeric
  6233.          values or  not.   In order  to express  a number as a 2's compliment
  6234.          integer word,  this variable  is required.   If only a byte value is
  6235.          needed, refer to the %(###) variable.
  6236.  
  6237.          See also:  %WT, %(###)
  6238.  
  6239.  
  6240.        ,---------------------------------------------------------------------,
  6241.          %WT%WT(wordvalue)       |                                                                     |
  6242.        `---------------------------------------------------------------------'
  6243.          Returns the numeric text value of a binary word integer.
  6244.  
  6245.          The 32-bit value returned is unsigned.
  6246.  
  6247.          About the  only time  you would  need the  function provided by this
  6248.          variable is  if you  read a  word value  from a file using the READB
  6249.  
  6250.  
  6251.  
  6252.                                           98
  6253.  
  6254.  
  6255.                                    Macro Language - System Variable Reference
  6256.        ----------------------------------------------------------------------
  6257.  
  6258.  
  6259.          macro command and need to convert the value to text in order to work
  6260.          with it or display it.
  6261.  
  6262.          This variable performs the opposite function of the %WD variable.
  6263.  
  6264.          See also:  %WD
  6265.  
  6266.  
  6267.        ,---------------------------------------------------------------------,
  6268.          %XC%XC(char,length)       |                                                                     |
  6269.        `---------------------------------------------------------------------'
  6270.          Returns a string of "char", "length" characters long.
  6271.  
  6272.          If a  string of  spaces is  desired, the  space  character  must  be
  6273.          represented as  %(32).   This is  due to the internal parsing of the
  6274.          parameter list  which discards leading and trailing space characters
  6275.          between arguments.   This  is even  more critical  in IF statements,
  6276.          where not  only will  the %XC  not expand  correctly, but  a literal
  6277.          space  character  might  be  misconstrued  as  a  delimiter  between
  6278.          operands.
  6279.  
  6280.          Where practical,  it is  more memory  efficient  to  express  longer
  6281.          strings using %XC than to represent them literally in macro code.
  6282.  
  6283.          See also:  %SS
  6284.  
  6285.          Examples:
  6286.  
  6287.              ECHO %XC(=,5)           ;;DISPLAYS A "====="
  6288.              ECHO %XC(%(32),30)      ;;DISPLAYS 30 SPACES
  6289.              ECHO %XC(%(205),80)     ;;DRAW A LINE OF "-"
  6290.  
  6291.  
  6292.        ,---------------------------------------------------------------------,
  6293.          %XM%XM       |                                                                     |
  6294.        `---------------------------------------------------------------------'
  6295.          This is a special variable that acts more like a switch.  It doesn't
  6296.          return anything  (its presence in a command line is simply deleted).
  6297.          Leading or  trailing spaces  surrounding %XM are significant though.
  6298.          What %XM does is it tells dCOM to swap itself out to expanded memory
  6299.          or disk  the next  time  an  external  application  is  run.    This
  6300.          effectively reduces  dCOM to less than 10k in memory (a small kernel
  6301.          has to  remain in memory in order to reload the swapped out code and
  6302.          data).
  6303.  
  6304.          Normally you  include this variable on the actual line that runs the
  6305.          program, but  its possible to use it several lines before as long as
  6306.          you're sure that the next externally run program is the one you want
  6307.          it to work with.
  6308.  
  6309.          Instead of  using this  variable however,  a text file called XM.SYS
  6310.          can be  created in  dCOM's home directory that contains the names of
  6311.  
  6312.  
  6313.                                           99
  6314.  
  6315.  
  6316.                                    Macro Language - System Variable Reference
  6317.        ----------------------------------------------------------------------
  6318.  
  6319.  
  6320.          programs for  which you  need the "extra memory".  In this file, the
  6321.          program  names   can  be  separated  by  spaces,  commas,  tabs,  or
  6322.          individually per  line.   If a  program name  is given  without  its
  6323.          extension (.COM or .EXE), either one will qualify as a match.
  6324.  
  6325.          When a  program is run with the "XM" effect, the background benefits
  6326.          of dCOM are removed until the program terminates.  This includes the
  6327.          print spooler,  printer redirection,  screen saver,  screen blanker,
  6328.          alarms, all  of the  hot keys,  etc...   (Believe it or not, the 45k
  6329.          that dCOM normally leaves behind when it runs a program is there for
  6330.          a reason.)
  6331.  
  6332.          Another side  effect is  that any  TSR's currently  loaded in dCOM's
  6333.          memory are automatically ejected.  Reducing dCOM down to a 10k image
  6334.          does no good if a TSR is sitting directly above the released memory.
  6335.          And, if  the application itself loaded a TSR (or was a TSR), it will
  6336.          quietly be  given the  boot as  well when  control returns to dCOM -
  6337.          because dCOM needs to reload itself back into the same memory it was
  6338.          in to start with.
  6339.  
  6340.          When a  program is run with the "XM" effect, dCOM will first attempt
  6341.          to save the swap image to expanded memory.  If expanded memory isn't
  6342.          present, it  will save  it to  a temporary  file on disk.  Where the
  6343.          temporary file  is saved  depends on several things.  If dCOM's /TMP
  6344.          command line  switch was  specified, it will take precedence and the
  6345.          temp file  is always  stored there.  If the /TMP command line switch
  6346.          wasn't specified,  dCOM will react to on-the-fly changes to the TEMP
  6347.          environment variable  (the same  environment variable  Windows uses)
  6348.          and place  the temp  file there.   If  neither are defined, the temp
  6349.          file is stored in dCOM's home directory.
  6350.  
  6351.          If dCOM  is run from a network drive and the user doesn't have Write
  6352.          and Create  privileges to dCOM's home directory, and expanded memory
  6353.          isn't present  - you should ensure that either the /TMP command line
  6354.          switch, or  the TEMP environment variable point to a directory where
  6355.          the user  does have  Create, Write,  Read, and Erase privileges - or
  6356.          the "XM" effect will silently just not work.
  6357.  
  6358.  
  6359.  
  6360.  
  6361.  
  6362.  
  6363.  
  6364.  
  6365.  
  6366.  
  6367.  
  6368.  
  6369.  
  6370.  
  6371.  
  6372.  
  6373.  
  6374.                                           100
  6375.  
  6376.  
  6377.                                                     Macro Language - Examples
  6378.        ----------------------------------------------------------------------
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.                                    Macro ExamplesMacro Examples
  6385.  
  6386.        The following  examples are  provided to  help illustrate  some  macro
  6387.        capabilities.   They are  not meant to in any way imply an endorsement
  6388.        or advocate the use of one brand of software over another.
  6389.  
  6390.        When considering  the examples,  a certain  amount of  interpretation,
  6391.        adjustment, and/or  substitution may  be required  to  suit  your  own
  6392.        situations.
  6393.  
  6394.        Each of  the macro  examples uses  the  F1  key  for  its  title  line
  6395.        definition.   If you  implement any of the examples, you will probably
  6396.        need to  change F1  to a  key that hasn't already been defined.  Also,
  6397.        every macro  line has  been commented  with an explanation of what the
  6398.        line does.  If you use these examples as a basis to build some of your
  6399.        macro keys, typing in the comments is purely optional.
  6400.  
  6401.  
  6402.                       Changing to a Frequently Used DirectoryChanging to a Frequently Used Directory
  6403.  
  6404.        ,---------------------------------------------------------------------,
  6405.         [F1] CD C:\DOCS                        ;;TITLE LINE AND SWITCHES       |                                                                     |
  6406.              CDD C:\DOCS                       ;;CHANGE DRIVE & DIRS       |                                                                     |
  6407.        `---------------------------------------------------------------------'
  6408.  
  6409.        This example  changes drives  and subdirectories  to  C:\DOCS.    Even
  6410.        something as  simple as this can prove to be quite a time saver if you
  6411.        have a  reason to frequently visit particular subdirectories.  Another
  6412.        variation along the same lines would be to use a macro key to just log
  6413.        a new  drive.   This would  be done  by replacing  "CDD C:\DOCS"  with
  6414.        something like "A:".
  6415.  
  6416.  
  6417.  
  6418.                       Running a Program - In Its Own DirectoryRunning a Program - In Its Own Directory
  6419.  
  6420.        ,---------------------------------------------------------------------,
  6421.         [F1] WORDSTAR 6                        ;;TITLE LINE AND SWITCHES       |                                                                     |
  6422.              CDD C:\WS6                        ;;CHANGE DRIVE & DIRS       |                                                                     |
  6423.              WS                                ;;RUN WORDSTAR       |                                                                     |
  6424.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  6425.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6426.        `---------------------------------------------------------------------'
  6427.  
  6428.        This example  just runs Wordstar, but it typifies the basic "shell" of
  6429.        how a  macro would  look that  runs programs.   Note  that we took the
  6430.        extra precaution  of changing  drives and  directories with  the "CDD"
  6431.        macro command.  If all we did was a "CD \WS6", the macro wouldn't work
  6432.        properly if  the current  drive wasn't drive C:.  Also, after Wordstar
  6433.  
  6434.  
  6435.                                           101
  6436.  
  6437.  
  6438.                                                     Macro Language - Examples
  6439.        ----------------------------------------------------------------------
  6440.  
  6441.  
  6442.        exits, the  current directory  of drive C: is arbitrarily changed back
  6443.        to its  root directory,  and then  CDDO changes  the default drive and
  6444.        current directory  back to  whatever was  active when  the  macro  key
  6445.        initially ran.   If  the macro  key was initially run while C: was the
  6446.        default drive, the CDDO would immediately nullify the line before that
  6447.        changes C: to the root.  In any event, C: won't be left sitting in the
  6448.        \WS6 directory.
  6449.  
  6450.  
  6451.  
  6452.                         Running a Program - That Uses TSR'sRunning a Program - That Uses TSR's
  6453.  
  6454.        ,---------------------------------------------------------------------,
  6455.         [F1] WORDSTAR 5/r                      ;;TITLE LINE AND SWITCHES       |                                                                     |
  6456.              CDD C:\WS5                        ;;CHANGE DRIVE & DIRS       |                                                                     |
  6457.              WF                                ;;LOAD WORD FINDER (A TSR)       |                                                                     |
  6458.              WS                                ;;RUN WORDSTAR       |                                                                     |
  6459.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  6460.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6461.        `---------------------------------------------------------------------'
  6462.  
  6463.        This example is a spin-off of the previous example.  The difference is
  6464.        that the  macro is  configured to  remove TSR's when it terminates (by
  6465.        using the  /R switch  on the  title line)  and also  loads Word Finder
  6466.        before running  Wordstar.  Word Finder is a Thesaurus type TSR program
  6467.        which is  useful when  used  in  conjunction  with  Wordstar,  but  is
  6468.        normally of  little use  after  you  are  done  working  in  Wordstar.
  6469.        (Current versions  of Wordstar  no longer  use the  Word Finder  as  a
  6470.        separate program, but the example still applies.)
  6471.  
  6472.  
  6473.  
  6474.                 Running a Program - With the Currently Selected FileRunning a Program - With the Currently Selected File
  6475.  
  6476.        ,---------------------------------------------------------------------,
  6477.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  6478.              PATHADD C:\WORD                   ;;ADD C:\WORD TO PATH       |                                                                     |
  6479.              WORD %FE                          ;;RUN WORD WITH SEL'D FILE       |                                                                     |
  6480.              PATHDEL C:\WORD                   ;;REMOVE C:\WORD FROM PATH       |                                                                     |
  6481.        `---------------------------------------------------------------------'
  6482.  
  6483.        This example runs MS-Word, passing to it the filename of the currently
  6484.        selected file  from the file handler.  Before running Word though, the
  6485.        macro temporarily  adds the path to Word's program files to the MS-DOS
  6486.        PATH.   This ensures  it will  run correctly  even if the AUTOEXEC.BAT
  6487.        didn't set  a path  to Word.   If  AUTOEXEC.BAT does set a path to MS-
  6488.        Word, you  wouldn't want  to use  the PATHADD  and PATHDEL  statements
  6489.        because PATHDEL will remove all entries of C:\WORD from the path.
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.                                           102
  6497.  
  6498.  
  6499.                                                     Macro Language - Examples
  6500.        ----------------------------------------------------------------------
  6501.  
  6502.  
  6503.        ,---------------------------------------------------------------------,
  6504.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  6505.              CDD C:\WORD                       ;;CHANGE DRIVE & DIRS       |                                                                     |
  6506.              WORD %OD%OS\%FE                   ;;RUN WORD WITH SEL'D FILE       |                                                                     |
  6507.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  6508.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6509.        `---------------------------------------------------------------------'
  6510.  
  6511.        This is  a variation  on the  previous example.  It changes to the MS-
  6512.        Word program  directory and  then runs  Word, passing  to it  the full
  6513.        pathspec of  the filename  that was  currently selected when the macro
  6514.        key was  invoked.  %OD expands into the original drive that was active
  6515.        when the  macro key  was pressed  (i.e. "C:").   %OS  expands into the
  6516.        original subdirectory  that was  active when the macro key was pressed
  6517.        (i.e. "\DOCS").   And %FE expands into the currently selected filename
  6518.        with its extension.
  6519.  
  6520.        This is not a normal approach to running a program however, because if
  6521.        you try to open additional documents while in the program, the current
  6522.        directory will  most likely  not be  in the same directory as when you
  6523.        invoked the  macro.  It is only provided as an example of how to do it
  6524.        should the occasion arise.
  6525.  
  6526.  
  6527.  
  6528.                      Running a Program - Selecting a File FirstRunning a Program - Selecting a File First
  6529.  
  6530.        Often it is desirable to display a menu that allows the user to select
  6531.        from a  list of  available  files  or  directories  before  running  a
  6532.        program.  There are many ways in which this can be done.
  6533.  
  6534.  
  6535.        ,---------------------------------------------------------------------,
  6536.         [F1] HARVARD GRAPHICS                  ;;TITLE LINE AND SWITCHES       |                                                                     |
  6537.              SELECT C:\HG\*.CHT Pick a Chart/n ;;PROMPT FOR FILE TO USE       |                                                                     |
  6538.              CDD C:\HG                         ;;CHANGE DRIVE & DIRS       |                                                                     |
  6539.              HG %SE                            ;;RUN HARVARD W/FILE PICKED       |                                                                     |
  6540.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  6541.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6542.        `---------------------------------------------------------------------'
  6543.  
  6544.        This is  the simplest  method of  selecting  a  file  before  you  run
  6545.        something.   It assumes  that all  of the chart files are in Harvard's
  6546.        directory, not  off in a separate directory.  It first prompts for the
  6547.        user to  select a  Harvard chart  file, then it changes into Harvard's
  6548.        program directory  and runs  Harvard passing  it the  filename of  the
  6549.        chart picked.
  6550.  
  6551.        But what  if you  want to  pick a file that's in a different directory
  6552.        than where  the program's  executable files are?  So we'll go from one
  6553.        extreme to the other.  Lets also say that the files are in a directory
  6554.  
  6555.  
  6556.  
  6557.                                           103
  6558.  
  6559.  
  6560.                                                     Macro Language - Examples
  6561.        ----------------------------------------------------------------------
  6562.  
  6563.  
  6564.        structure that's  categorized using  different  subdirectories.    For
  6565.        example:
  6566.  
  6567.              C:\---DOS
  6568.                  |-DCOM
  6569.                  |-DOCS-----REPORTS
  6570.                  |        |-CORES
  6571.                  |        |-MEMOS
  6572.                  |        `-MISC
  6573.                  `-WORD
  6574.  
  6575.        ,---------------------------------------------------------------------,
  6576.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  6577.              SELECT C:\DOCS\*.* PICK A DIR/d   ;;PROMPT FOR DIR TO USE       |                                                                     |
  6578.              %DIR=%SE                          ;;%DIR=SELECTED DIR       |                                                                     |
  6579.              SELECT C:\DOC\%DIR\*.DOC FILES/n  ;;PROMPT FOR FILE TO USE       |                                                                     |
  6580.              CDD C:\DOCS\%DIR                  ;;CHANGE DRIVE & DIRS       |                                                                     |
  6581.              WORD %SE                          ;;RUN WORD WITH THE FILE       |                                                                     |
  6582.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  6583.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6584.        `---------------------------------------------------------------------'
  6585.  
  6586.        This example  first displays  a menu  of the subdirectories that exist
  6587.        under C:\DOCS.   Then,  it displays a second menu of all files in that
  6588.        subdirectory which  have a .DOC extension.  (The reason why the SELECT
  6589.        command is  suddenly capable  of showing subdirectory names instead of
  6590.        filenames is  because of the /D switch.)  Then, it runs Microsoft Word
  6591.        with the  name of the file selected.  In this example we're relying on
  6592.        the PATH to find MS-Word.
  6593.  
  6594.  
  6595.  
  6596.               Running a Program - Selecting a File First (Version II)Running a Program - Selecting a File First (Version II)
  6597.  
  6598.        ,---------------------------------------------------------------------,
  6599.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  6600.              SELECT C:\DOCS\*.DOC Files/n/p    ;;PROMPT FOR FILE TO USE       |                                                                     |
  6601.              PATHADD C:\WORD                   ;;ADD C:\WORD TO PATH       |                                                                     |
  6602.              CDD %SP                           ;;CHANGE DRIVE & DIRS       |                                                                     |
  6603.              WORD %SE                          ;;RUN WORD WITH FILE PICKED       |                                                                     |
  6604.              PATHDEL C:\WORD                   ;;REMOVE C:\WORD FROM PATH       |                                                                     |
  6605.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  6606.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6607.        `---------------------------------------------------------------------'
  6608.  
  6609.        This example starts to spruce things up a little.  It first displays a
  6610.        menu that  allows the  user to  select a file before running Microsoft
  6611.        Word.  Since the /P switch was given with the SELECT command, the user
  6612.        has the  option to change drives and/or directories before selecting a
  6613.        file.   Next, Word's  directory is  added to  the  path,  the  current
  6614.        directory is  changed to the one in which the file was selected (%SP),
  6615.        and then  Word is  run with  the filename  picked.   If [NEW FILE] was
  6616.  
  6617.  
  6618.                                           104
  6619.  
  6620.  
  6621.                                                     Macro Language - Examples
  6622.        ----------------------------------------------------------------------
  6623.  
  6624.  
  6625.        picked from the SELECT menu (because the /N switch was used), %SE will
  6626.        return nothing and hence, Word will start with an empty window.
  6627.  
  6628.        So why  didn't we change into the C:\DOCS directory before issuing the
  6629.        SELECT command?   That  way we wouldn't have to spell out the path for
  6630.        SELECT, right?   The  reason why  its normally  better to  use  SELECT
  6631.        commands (with full paths to what you want selected) before you change
  6632.        directories is  because if  the SELECT menu is escaped, the macro will
  6633.        abort - probably leave you sitting in a different directory than where
  6634.        you were  before the macro was invoked.  But, with a couple more macro
  6635.        lines we can trap that Escape key....
  6636.  
  6637.  
  6638.        ,---------------------------------------------------------------------,
  6639.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  6640.              ONBREAKGOTO ABORT                 ;;TRAP THE ESCAPE KEY       |                                                                     |
  6641.              CDD C:\DOCS                       ;;CHANGE DRIVE AND DIRS       |                                                                     |
  6642.              SELECT *.DOC Pick a Document/n    ;;PROMPT FOR FILE TO USE       |                                                                     |
  6643.              PATHADD C:\WORD                   ;;ADD C:\WORD TO PATH       |                                                                     |
  6644.              WORD %SE                          ;;RUN WORD WITH FILE PICKED       |                                                                     |
  6645.              PATHDEL C:\WORD                   ;;REMOVE C:\WORD FROM PATH       |                                                                     |
  6646.              :ABORT                            ;;ESCAPE KEY JUMP POINT       |                                                                     |
  6647.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  6648.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6649.        `---------------------------------------------------------------------'
  6650.  
  6651.        This example  traps the  Escape key  when the  SELECT menu  is active.
  6652.        Since we  are trapping  Escape,  its  safe  to  go  ahead  and  change
  6653.        directories first  before displaying  the SELECT  menu.   If we didn't
  6654.        trap it,  pressing Escape  while the SELECT menu is active would abort
  6655.        the macro and leave it in the C:\DOCS directory.
  6656.  
  6657.        Also, since  we didn't  use the /P option with the SELECT command, the
  6658.        user will not have an option to pick a file in a different directory.
  6659.  
  6660.  
  6661.  
  6662.                     Running a Program - Saving Current DirectoryRunning a Program - Saving Current Directory
  6663.  
  6664.        ,---------------------------------------------------------------------,
  6665.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  6666.              %ORIGDIR=%CD(C:)                  ;;%ORIGDIR = DRV C:'S CUR DIR       |                                                                     |
  6667.              PATHADD C:\WORD                   ;;ADD C:\WORD TO THE PATH       |                                                                     |
  6668.              CDD C:\DOCS                       ;;CHANGE DRIVE & DIRS       |                                                                     |
  6669.              WORD                              ;;RUN WORD FROM PATH       |                                                                     |
  6670.              CD C:%ORIGDIR                     ;;RESTORE C: TO ORIG DIR       |                                                                     |
  6671.              PATHDEL C:\WORD                   ;;REMOVE C:\WORD FROM PATH       |                                                                     |
  6672.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  6673.        `---------------------------------------------------------------------'
  6674.  
  6675.        This example  goes way  out of  its way  to restore  all  the  current
  6676.        directories to  the way  they  were  when  the  macro  key  was  first
  6677.  
  6678.  
  6679.                                           105
  6680.  
  6681.  
  6682.                                                     Macro Language - Examples
  6683.        ----------------------------------------------------------------------
  6684.  
  6685.  
  6686.        executed.  Normally, when you run a macro key from the same drive that
  6687.        the macro  key uses when it changes directories, the CDDO command will
  6688.        take care  of restoring  it to  its original directory.  In all of the
  6689.        previous examples  we were  arbitrarily changing  C: back  to its root
  6690.        directory in  case CDDO was going to restore to a different drive.  If
  6691.        you really  want to  cover all the bases though, this is how you would
  6692.        do it.
  6693.  
  6694.        Additionally, the  macro temporarily  adds the  path to Word's program
  6695.        files to  the MS-DOS PATH before running it.  This ensures it will run
  6696.        correctly even  if the  AUTOEXEC.BAT didn't  set a  path to  Word.  If
  6697.        AUTOEXEC.BAT does  set a path to MS-Word, you wouldn't want to use the
  6698.        PATHADD and PATHDEL statements because PATHDEL will remove all entries
  6699.        of C:\WORD from the path.
  6700.  
  6701.  
  6702.  
  6703.                    Running a Program - Menuing Some Options FirstRunning a Program - Menuing Some Options First
  6704.  
  6705.        ,---------------------------------------------------------------------,
  6706.         [F1] FORMAT                            ;;TITLE LINE AND SWITCHES       |                                                                     |
  6707.              MENU FORMAT,A:,B:                 ;;DISPLAY DRIVE OPTIONS       |                                                                     |
  6708.              %DRIVE=%MT                        ;;SAVE IT IN %DRIVE       |                                                                     |
  6709.              MENU FORMAT %DRIVE                ;;DISPLAY       |                                                                     |
  6710.                .360K                           ;;  MS-DOS       |                                                                     |
  6711.                .720K                           ;;  FORMAT'S       |                                                                     |
  6712.                .1.2M                           ;;  /F:       |                                                                     |
  6713.                .1.44M                          ;;  OPTIONS       |                                                                     |
  6714.              FORMAT %DRIVE /F:%MT              ;;RUN FORMAT WITH SELECTIONS       |                                                                     |
  6715.        `---------------------------------------------------------------------'
  6716.  
  6717.        This example  first displays  a menu of the possible drives to format.
  6718.        Then,  it   displays  a  menu  of  options  that  the  Format  program
  6719.        understands (MS-DOS  Version 4.0+)  when passed  with its  /F  switch.
  6720.        Then, it  runs the MS-DOS Format program to do it (relying on the PATH
  6721.        to find it).
  6722.  
  6723.  
  6724.  
  6725.                                   Dropping to DosDropping to Dos
  6726.  
  6727.        ,---------------------------------------------------------------------,
  6728.         [F1] DROP TO DOS                       ;;TITLE LINE AND SWITCHES       |                                                                     |
  6729.              %OLD_PROMPT=%[PROMPT]             ;;SAVE PREVIOUS PROMPT VALUE       |                                                                     |
  6730.              SET PROMPT=Type EXIT to Ret to dCOM$_$P$G   ;;SET NEW PROMPT       |                                                                     |
  6731.              %[COMSPEC] %XM                    ;;RUN A COPY OF COMMAND.COM       |                                                                     |
  6732.              SET PROMPT=%OLD_PROMPT            ;;RESTORE PREVIOUS PROMPT       |                                                                     |
  6733.        `---------------------------------------------------------------------'
  6734.  
  6735.        This example  saves  the  current  value  of  the  PROMPT  environment
  6736.        variable and then sets it so that it will display a message indicating
  6737.        how to  return to  dCOM.  Then, it runs another copy of COMMAND.COM by
  6738.  
  6739.  
  6740.                                           106
  6741.  
  6742.  
  6743.                                                     Macro Language - Examples
  6744.        ----------------------------------------------------------------------
  6745.  
  6746.  
  6747.        using the current value of the COMSPEC environment variable.  When the
  6748.        user types 'EXIT', COMMAND.COM terminates (just like exiting any other
  6749.        program), and the previous value of the PROMPT is restored.
  6750.  
  6751.        Also, when  COMMAND.COM is  run, the %XM system variable is used which
  6752.        tells dCOM  to reduce itself to a 10k kernel by swapping itself out of
  6753.        conventional memory  to either  expanded memory or disk.  Normally you
  6754.        don't want  to use %XM unless you know the program is running short of
  6755.        memory.   If you  use %XM,  some extra  disk activity  will  occur  if
  6756.        expanded memory  isn't present,  and you'll lose the benefit of having
  6757.        dCOM in  the background  (i.e.  print  spooler,  printer  redirection,
  6758.        screen saver/blanker,  etc...).   In this  case, since the user can or
  6759.        might want to run another significant application from the DOS prompt,
  6760.        using %XM is not such a bad idea.
  6761.  
  6762.  
  6763.  
  6764.                        Setting an Epson Printer to CompressedSetting an Epson Printer to Compressed
  6765.  
  6766.        ,---------------------------------------------------------------------,
  6767.         [F1] COMPRESSED PITCH                  ;;TITLE LINE AND SWITCHES       |                                                                     |
  6768.              PRINTSTR %(15)                    ;;SEND COMPRESS CODE TO PRN       |                                                                     |
  6769.        `---------------------------------------------------------------------'
  6770.  
  6771.        This example sets an Epson compatible printer into compressed (16 CPI)
  6772.        pitch.
  6773.  
  6774.  
  6775.  
  6776.                        Setting an Epson Printer to Pica PitchSetting an Epson Printer to Pica Pitch
  6777.  
  6778.        ,---------------------------------------------------------------------,
  6779.         [F1] PICA PITCH                        ;;TITLE LINE AND SWITCHES       |                                                                     |
  6780.              PRINTSTR %(18)                    ;;SEND 10 CPI CODE TO PRN       |                                                                     |
  6781.        `---------------------------------------------------------------------'
  6782.  
  6783.        This example  sets an Epson compatible printer to Pica (10 CPI) pitch.
  6784.        This example,  along with  the one above, suggests how an entire macro
  6785.        file could be used to set various printer pitches or modes.
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.                                           107
  6802.  
  6803.  
  6804.                                                     Macro Language - Examples
  6805.        ----------------------------------------------------------------------
  6806.  
  6807.  
  6808.                                Submenuing a Macro KeySubmenuing a Macro Key
  6809.  
  6810.        ,---------------------------------------------------------------------,
  6811.         [F1] WORD PROCESSING                   ;;TITLE LINE AND SWITCHES       |                                                                     |
  6812.              MENU WORD PROCESSING              ;;DISPLAY A MENU WITH       |                                                                     |
  6813.               .MS-Word                         ;;  WORDPROCESSING       |                                                                     |
  6814.               .WordStar                        ;;  CHOICES       |                                                                     |
  6815.              GOTO %MT                          ;;GOTO LABEL OF TEXT PICKED       |                                                                     |
  6816.              :MS-WORD                          ;;LABEL FOR GOTO       |                                                                     |
  6817.                CDD C:\MSWORD                   ;;  CHANGE DRIVE & DIRS       |                                                                     |
  6818.                WORD                            ;;  RUN MS-WORD       |                                                                     |
  6819.                CD C:\                          ;;  CHANGE C: TO ROOT DIR       |                                                                     |
  6820.                CDDO                            ;;  RETURN TO ORIG DRV & DIR       |                                                                     |
  6821.                EXIT                            ;;  AND EXIT THE MACRO       |                                                                     |
  6822.              :WORDSTAR                         ;;LABEL FOR GOTO       |                                                                     |
  6823.                CDD C:\WS5                      ;;  CHANGE DRIVE & DIRS       |                                                                     |
  6824.                WS                              ;;  RUN WORDSTAR       |                                                                     |
  6825.                CD C:\                          ;;  CHANGE C: TO ROOT DIR       |                                                                     |
  6826.                CDDO                            ;;  RETURN TO ORIG DRV & DIR       |                                                                     |
  6827.                EXIT                            ;;  AND EXIT THE MACRO       |                                                                     |
  6828.        `---------------------------------------------------------------------'
  6829.  
  6830.        This example  demonstrates the  use of the MENU command and how it can
  6831.        be used  to pop-up  a submenu  of choices.   Since  the  MENU  command
  6832.        returns the  text of  the choice selected in %MT, all the macro has to
  6833.        do is  issue a  GOTO command  to jump  to a  label containing the text
  6834.        selected.  This technique could just as easily be applied to getting a
  6835.        Yes or  No response from the user before doing something that warrants
  6836.        it.
  6837.  
  6838.        In general  though, loading your primary macro file with a lot of text
  6839.        should be avoided because it can accumulate into having a minor effect
  6840.        on free  memory (unless expanded memory is present).  Another solution
  6841.        might be  to build another macro file having these options as separate
  6842.        macro keys, and use the GOSUBMF macro command to call it.
  6843.  
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.  
  6860.  
  6861.  
  6862.                                           108
  6863.  
  6864.  
  6865.                                                     Macro Language - Examples
  6866.        ----------------------------------------------------------------------
  6867.  
  6868.  
  6869.                                Archiving Tagged FilesArchiving Tagged Files
  6870.  
  6871.        ,---------------------------------------------------------------------,
  6872.         [F1] ZIP TAGGED FILES/w                ;;TITLE LINE AND SWITCHES       |                                                                     |
  6873.              IF %TC=0 THEN                     ;;IF NO FILES TAGGED       |                                                                     |
  6874.                BEEP                            ;; BEEP       |                                                                     |
  6875.                MENU Tagged Files Required      ;; DISPLAY ERROR MESSAGE       |                                                                     |
  6876.                 .Press Return to Continue      ;;   AS A MENU       |                                                                     |
  6877.                EXIT                            ;; AND TERMINATE MACRO KEY       |                                                                     |
  6878.              ENDIF                             ;;END OF IF BLOCK       |                                                                     |
  6879.              GETW %FILE 13 Target ZIP File:    ;;GET DEST FILE IN %FILE       |                                                                     |
  6880.              ECHO Building List File           ;;DISPLAY WHAT WE'RE DOING       |                                                                     |
  6881.              CREATE #1,C:\ZIPDAT.TMP           ;;CREATE TEMPORARY LIST FILE       |                                                                     |
  6882.              :LABEL1                           ;;LABEL FOR TAGGED LOOP       |                                                                     |
  6883.                WRITE #1,%TE                    ;; ADD FILENAME TO LIST       |                                                                     |
  6884.              LOOP LABEL1                       ;;LOOP THROUGH TAGGED FILES       |                                                                     |
  6885.              CLOSE #1                          ;;CLOSE THE TEMP LIST FILE       |                                                                     |
  6886.              PKZIP -ex -z %FILE @C:\ZIPDAT.TMP ;;CALL PKZIP TO DO IT       |                                                                     |
  6887.              DEL C:\ZIPDAT.TMP                 ;;DELETE THE TEMP LIST FILE       |                                                                     |
  6888.        `---------------------------------------------------------------------'
  6889.  
  6890.        This example  takes all  tagged files  and compresses them into a .ZIP
  6891.        file.
  6892.  
  6893.        It first  tests on  whether there  are any  files tagged.   If not, it
  6894.        displays a  menu indicating that the macro needs tagged files and then
  6895.        exits.   If there  are tagged  files, the  IF block is skipped and the
  6896.        macro asks  for a  destination ZIP  filename.  After that, it builds a
  6897.        temporary ASCII  file that  contains the  names of all files that were
  6898.        tagged, and  then calls  PKZIP to add them to the ZIP filename entered
  6899.        in %FILE.
  6900.  
  6901.        Did you notice how the MENU command can be used as an easy way to pop-
  6902.        up an  error message?   Also,  because of the total length of the text
  6903.        for the  menu header and options, it was split between two macro lines
  6904.        by starting  the second  line with a period.  In this case however, it
  6905.        would have  been OK to have it all on one line separated with a comma,
  6906.        except then we couldn't have commented it in an aesthetic fashion.
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.                                           109
  6924.  
  6925.  
  6926.                                                     Macro Language - Examples
  6927.        ----------------------------------------------------------------------
  6928.  
  6929.  
  6930.                          Converting All .ARC Files to .ZIPConverting All .ARC Files to .ZIP
  6931.  
  6932.        ,---------------------------------------------------------------------,
  6933.         [F1] ARC->ZIP (ALL)/w                  ;;TITLE LINE AND SWITCHES       |                                                                     |
  6934.              IF EXIST C:\TDIR\*.* THEN         ;;IF TEMP DIR ALREADY EXISTS       |                                                                     |
  6935.                BEEP                            ;; BEEP       |                                                                     |
  6936.                MENU Temp Dir Already Has Files ;; DISPLAY ERROR MESSAGE       |                                                                     |
  6937.                 .ABORT                         ;;   1ST OPTION       |                                                                     |
  6938.                 .PROCEED                       ;;   2ND OPTION       |                                                                     |
  6939.                IF %MS=1 EXIT                   ;;   IF CHOICE IS ABORT, EXIT       |                                                                     |
  6940.                DEL C:\TDIR\*.* /h/n            ;; DEL ANYTHING IN \TDIR       |                                                                     |
  6941.              ENDIF                             ;;END OF IF BLOCK       |                                                                     |
  6942.        |                                                                     |
  6943.              IF NOT EXIST C:\TDIR MD C:\TDIR   ;;MAKE TEMP DIR IF NOT EXIST       |                                                                     |
  6944.              DO *.ARC                          ;;DO BLOCK FOR .ARC FILES       |                                                                     |
  6945.                ECHO Extracting: %DE;           ;; DISPLAY FILE BEING UNARC'D       |                                                                     |
  6946.                PKUNPAK %DE C:\TDIR >NUL        ;; UNARC THE FILE       |                                                                     |
  6947.                IF %EL>0 GOTO ERROR             ;; IF ERROR UNPACKING, ABORT       |                                                                     |
  6948.                DEL %DE                         ;; DELETE THE .ARC FILE       |                                                                     |
  6949.                CPOSN ,27                       ;; POSITION CURSOR TO COL 27       |                                                                     |
  6950.                ECHO Zipping: %DN.ZIP;          ;; DISPLAY FILE BEING ZIPPED       |                                                                     |
  6951.                PKZIP -m %DN.ZIP C:\TDIR\*.* >NUL    ;; ZIP THE UNARCED FILES       |                                                                     |
  6952.                ECHO                            ;; DROP A LINE       |                                                                     |
  6953.              ENDDO                             ;;END OF DO BLOCK       |                                                                     |
  6954.              RD C:\TDIR                        ;;REMOVE THE TEMP DIRECTORY       |                                                                     |
  6955.              EXIT                              ;; AND EXIT       |                                                                     |
  6956.              :ERROR                            ;;ERROR JUMP POINT       |                                                                     |
  6957.                BEEP                            ;; BEEP       |                                                                     |
  6958.                MENU Error %EL Extracting %DE   ;; DISPLAY ERROR AS MENU       |                                                                     |
  6959.                 .Press Return to Continue      ;;  USE 1ST OPTION AS PROMPT       |                                                                     |
  6960.        `---------------------------------------------------------------------'
  6961.  
  6962.        This example  converts all  .ARC files  found in the current directory
  6963.        from .ARC format to the more efficient .ZIP format.
  6964.  
  6965.  
  6966.  
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.  
  6980.  
  6981.  
  6982.  
  6983.  
  6984.                                           110
  6985.  
  6986.  
  6987.                                                     Macro Language - Examples
  6988.        ----------------------------------------------------------------------
  6989.  
  6990.  
  6991.                         Converting Tagged .ARC Files to .ZIPConverting Tagged .ARC Files to .ZIP
  6992.  
  6993.        ,---------------------------------------------------------------------,
  6994.         [F1] ARC->ZIP (TAGGED)/w               ;;TITLE LINE AND SWITCHES       |                                                                     |
  6995.              IF %TC=0 THEN                     ;;IF NO FILES ARE TAGGED       |                                                                     |
  6996.                BEEP                            ;;  BEEP       |                                                                     |
  6997.                MENU No Files Are Tagged        ;;  POP-UP A WINDOW THAT SAYS       |                                                                     |
  6998.                 .Press Return to Continue      ;;    NO FILES ARE TAGGED       |                                                                     |
  6999.                EXIT                            ;;  AND EXIT THE MACRO       |                                                                     |
  7000.              ENDIF                             ;;END OF IF BLOCK       |                                                                     |
  7001.              IF EXIST C:\TDIR\*.* THEN         ;;IF C:\TDIR ALREADY EXISTS       |                                                                     |
  7002.                BEEP                            ;; BEEP       |                                                                     |
  7003.                MENU Temp Dir Already Has Files ;; DISPLAY ERROR MESSAGE       |                                                                     |
  7004.                 .ABORT                         ;;   1ST OPTION       |                                                                     |
  7005.                 .PROCEED                       ;;   2ND OPTION       |                                                                     |
  7006.                IF %MS=1 EXIT                   ;;   IF CHOICE IS ABORT, EXIT       |                                                                     |
  7007.                DEL C:\TDIR\*.* /h/n            ;; DEL ANYTHING IN \TDIR       |                                                                     |
  7008.              ENDIF                             ;;END OF IF BLOCK       |                                                                     |
  7009.              IF NOT EXIST C:\TDIR MD C:\TDIR   ;;MAKE TEMP DIR IF NOT EXIST       |                                                                     |
  7010.              :LABEL1                           ;;LABEL FOR TAGGED LOOP       |                                                                     |
  7011.                IF %TE<>%TN.ARC THEN            ;; IF FILE IS NOT .ARC       |                                                                     |
  7012.                  BEEP                          ;;  BEEP       |                                                                     |
  7013.                  MENU %TE is Not an ARC File   ;;  POP-UP A MENU THAT SAYS       |                                                                     |
  7014.                   .Press Return to Continue    ;;    THIS ISN'T AN ARC FILE       |                                                                     |
  7015.                  GOTO QUIT                     ;;  AND EXIT THE MACRO       |                                                                     |
  7016.                ENDIF                           ;; END OF IF BLOCK       |                                                                     |
  7017.                ECHO Extracting: %TE;           ;; DISPLAY FILE BEING UNARC'D       |                                                                     |
  7018.                PKUNPAK %TE C:\TDIR >NUL        ;; UNARC THE FILE       |                                                                     |
  7019.                IF %EL>0 GOTO ERROR             ;; IF ERROR UNPACKING, ABORT       |                                                                     |
  7020.                DEL %TE                         ;; DELETE THE .ARC FILE       |                                                                     |
  7021.                CPOSN ,27                       ;; POSITION CURSOR TO COL 27       |                                                                     |
  7022.                ECHO Zipping: %TN.ZIP;          ;; DISPLAY FILE BEING ZIPPED       |                                                                     |
  7023.                PKZIP -m %TN.ZIP C:\TDIR\*.* >NUL    ;; ZIP THE UNARCED FILES       |                                                                     |
  7024.                ECHO                            ;; DROP A LINE       |                                                                     |
  7025.              LOOP LABEL1                       ;;LOOP BACK IF ANOTHER TAG       |                                                                     |
  7026.              :QUIT                             ;;LABEL FOR EXIT JUMP       |                                                                     |
  7027.                RD C:\TDIR                      ;;REMOVE THE TEMP DIR       |                                                                     |
  7028.                EXIT                            ;; AND EXIT       |                                                                     |
  7029.              :ERROR                            ;;ERROR JUMP POINT       |                                                                     |
  7030.                BEEP                            ;; BEEP       |                                                                     |
  7031.                MENU Error %EL Extracting %TE   ;; DISPLAY ERROR AS MENU       |                                                                     |
  7032.                 .Press Return to Continue      ;;  USE 1ST OPTION AS PROMPT       |                                                                     |
  7033.        `---------------------------------------------------------------------'
  7034.  
  7035.        This example converts all tagged .ARC files to the more efficient .ZIP
  7036.        format.
  7037.  
  7038.        Since the  LOOP command and its %TE and %TN variables will work on the
  7039.        selected file  if no  files are  tagged, you could remove the first IF
  7040.        block if you wished to allow that as an option.
  7041.  
  7042.  
  7043.  
  7044.  
  7045.                                           111
  7046.  
  7047.  
  7048.                                                     Macro Language - Examples
  7049.        ----------------------------------------------------------------------
  7050.  
  7051.  
  7052.                               Compiling a Source FileCompiling a Source File
  7053.  
  7054.        ,---------------------------------------------------------------------,
  7055.         [F1] COMPILE SELECTED/w                ;;TITLE LINE AND SWITCHES       |                                                                     |
  7056.              :LABEL1                           ;;LABEL FOR TAGGED LOOP       |                                                                     |
  7057.                IF %TE<>%TN.ASM THEN            ;; IF FILE ISN'T AN .ASM FILE       |                                                                     |
  7058.                  BEEP                          ;;  BEEP       |                                                                     |
  7059.                  MENU %TE Is Not a .ASM File   ;;  DISPLAY ERROR MESSAGE       |                                                                     |
  7060.                   .Press Return to Continue    ;;    AS A MENU       |                                                                     |
  7061.                  EXIT                          ;;  AND EXIT       |                                                                     |
  7062.                ENDIF                           ;; END OF IF BLOCK       |                                                                     |
  7063.                ECHO Compiling: %TE             ;; ECHO FILE BEING COMPILED       |                                                                     |
  7064.                MASM %TN;                       ;; COMPILE THE FILE       |                                                                     |
  7065.                IF %EL>0 GOTO ERROR             ;; IF AN ERROR GOTO ERROR       |                                                                     |
  7066.                LINK %TN;                       ;; LINK THE FILE       |                                                                     |
  7067.                IF %EL>0 GOTO ERROR             ;; IF AN ERROR GOTO ERROR       |                                                                     |
  7068.                DEL %TN.OBJ                     ;; DELETE THE .OBJ FILE       |                                                                     |
  7069.              LOOP LABEL1                       ;;IF TAGGED FILES LOOP BACK       |                                                                     |
  7070.              EXIT                              ;;TERMINATE THE MACRO KEY       |                                                                     |
  7071.              :ERROR                            ;;LABEL FOR ERROR HANDLING       |                                                                     |
  7072.                BEEP                            ;;BEEP FOR ERRORS       |                                                                     |
  7073.        `---------------------------------------------------------------------'
  7074.  
  7075.        This example  compiles and  links either  tagged files or the selected
  7076.        file.   It does  this easily  because the LOOP command and its %TE and
  7077.        %TN variables  automatically work on the selected file if no files are
  7078.        tagged.
  7079.  
  7080.        Most likely  though, if  someone was  going to  compile more  than one
  7081.        file, they  would probably  not want  to be  linking and  producing an
  7082.        executable file  for every object file compiled.  But more likely just
  7083.        compiling the  tagged files  to object  modules and  then linking them
  7084.        later in the same macro, or in a different macro key.
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093.  
  7094.  
  7095.  
  7096.  
  7097.  
  7098.  
  7099.  
  7100.  
  7101.  
  7102.  
  7103.  
  7104.  
  7105.  
  7106.                                           112
  7107.  
  7108.  
  7109.                                                     Macro Language - Examples
  7110.        ----------------------------------------------------------------------
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.                                 Searching For a FileSearching For a File
  7117.  
  7118.        The following  example is  a complete  macro file.   It  prompts for a
  7119.        couple parameters and then searches a directory structure for matching
  7120.        files, displaying each one found.  This macro file contains all of its
  7121.        macro code  under a  [FILEAUTO] definition, which activates as soon as
  7122.        the file is loaded into memory.
  7123.  
  7124.        ,---------------------------------------------------------------------,
  7125.         ;===================================================================       |                                                                     |
  7126.         ;                             SEARCH.MAC       |                                                                     |
  7127.         ;-------------------------------------------------------------------       |                                                                     |
  7128.         ; Description:       |                                                                     |
  7129.         ;       |                                                                     |
  7130.         ;   This macro searches a directory structure for a filemask       |                                                                     |
  7131.         ;   and displays entries found.       |                                                                     |
  7132.         ;       |                                                                     |
  7133.         ; Parameters on entry:       |                                                                     |
  7134.         ;   %p1 = Default starting search root directory       |                                                                     |
  7135.         ;   %p2 = Default filemask       |                                                                     |
  7136.         ;       |                                                                     |
  7137.         ; Notes:       |                                                                     |
  7138.         ;       |                                                                     |
  7139.         ;   This macro file should be installed in dCOM's Home       |                                                                     |
  7140.         ;   Directory and, can be called by the file handler's       |                                                                     |
  7141.         ;   "/" command, or by a local macro key as follows:       |                                                                     |
  7142.         ;       |                                                                     |
  7143.         ;   [f1]  Search for File       |                                                                     |
  7144.         ;         gosubmf search.mac [(search_root_dir,filemask)]       |                                                                     |
  7145.         ;       |                                                                     |
  7146.         ;                                                    September, 1991       |                                                                     |
  7147.         ;                                                       Dave Frailey       |                                                                     |
  7148.         ;                                                  DAC Micro Systems       |                                                                     |
  7149.         ;       |                                                                     |
  7150.         ;-------------------------------------------------------------------       |                                                                     |
  7151.         [menuauto]                             ;;just in case things go       |                                                                     |
  7152.                                                ;; wrong and we stay active       |                                                                     |
  7153.            return                              ;; up to the point of being       |                                                                     |
  7154.                                                ;; a menu, this will cause a       |                                                                     |
  7155.                                                ;; return to the previous       |                                                                     |
  7156.                                                ;; macro file.       |                                                                     |
  7157.        |                                                                     |
  7158.         ;-------------------------------------------------------------------       |                                                                     |
  7159.         [fileauto]                             ;;runs automatically when       |                                                                     |
  7160.                                                ;; this macro file loads       |                                                                     |
  7161.        |                                                                     |
  7162.            if %dv<362 then                     ;;if invalid version of dCOM       |                                                                     |
  7163.              onbreakgoto bad_v_break           ;; set escape trap       |                                                                     |
  7164.              beep                              ;; beep       |                                                                     |
  7165.  
  7166.  
  7167.                                           113
  7168.  
  7169.  
  7170.                                                     Macro Language - Examples
  7171.        ----------------------------------------------------------------------
  7172.  
  7173.  
  7174.              menu This Macro Requires dCOM Ver 3.62 or Greater       |                                                                     |
  7175.                   .Press Return to Continue       |                                                                     |
  7176.              :bad_v_break                      ;; break trap label       |                                                                     |
  7177.              return                            ;; return to calling macro       |                                                                     |
  7178.            endif                               ;;end of if block       |                                                                     |
  7179.        |                                                                     |
  7180.            %orig_dir=%od%os                    ;;save orig drive & directory       |                                                                     |
  7181.            if %p1=""                           ;;if starting dir not passed       |                                                                     |
  7182.              %start_dir=%ss(%orig_dir,1,3)     ;; set to deflt drive's root       |                                                                     |
  7183.            else                                ;;else       |                                                                     |
  7184.              %start_dir=%p1                    ;; set it to passed dir       |                                                                     |
  7185.            endif                               ;;end of if block       |                                                                     |
  7186.            %mask=%p2                           ;;%mask = passed search mask       |                                                                     |
  7187.        |                                                                     |
  7188.            onbreakgoto exit                    ;;set escape trap       |                                                                     |
  7189.            gosub display_screen                ;;display initial screen       |                                                                     |
  7190.            getw %start_dir 24 Starting Dir:    ;;get search root dir       |                                                                     |
  7191.            getw %mask 13 Enter Search Mask:    ;;get file mask to use       |                                                                     |
  7192.            if %at(.,%mask)=0                   ;;if mask doesn't have an ext       |                                                                     |
  7193.              %mask=%mask.???                   ;; append wildcard extension       |                                                                     |
  7194.            endif                               ;;end of if block       |                                                                     |
  7195.        |                                                                     |
  7196.            onerrorgoto error                   ;;set error trap       |                                                                     |
  7197.            cdd %start_dir                      ;;change to starting dir       |                                                                     |
  7198.            gosub search                        ;;do search       |                                                                     |
  7199.            cposn ,%w2                          ;;position to start of window       |                                                                     |
  7200.            ceol                                ;;clear off last dir disp'd       |                                                                     |
  7201.            gosub display_pause                 ;;display pause message       |                                                                     |
  7202.            goto exit                           ;;and exit       |                                                                     |
  7203.        |                                                                     |
  7204.            :error                              ;;error jump point       |                                                                     |
  7205.              beep                              ;; beep       |                                                                     |
  7206.              menu ERROR: %et                   ;; display error text       |                                                                     |
  7207.               .Press Return to Continue        ;; and rest of menu       |                                                                     |
  7208.            :exit                               ;;exit jump point       |                                                                     |
  7209.              cdd %orig_dir                     ;; return to orig drive & dir       |                                                                     |
  7210.              return                            ;; ret to calling macro file       |                                                                     |
  7211.        |                                                                     |
  7212.         ;-------------------------------------------------------------------       |                                                                     |
  7213.         :SEARCH                                ;;Search files & dirs in curr       |                                                                     |
  7214.                                                ;;---------------------------       |                                                                     |
  7215.        |                                                                     |
  7216.            cposn ,%w2                          ;;position to start of window       |                                                                     |
  7217.            echo %dd%cd\;                       ;;display current directory       |                                                                     |
  7218.            ceol                                ;;clear to end of line       |                                                                     |
  7219.            do %mask                            ;;do files in curr directory       |                                                                     |
  7220.              cposn ,%w2                        ;; position to start of win       |                                                                     |
  7221.              echo %dd%cd\%de                   ;; display the found file       |                                                                     |
  7222.            enddo                               ;;end of do block       |                                                                     |
  7223.            do *.*/d                            ;;do any subdir's in this dir       |                                                                     |
  7224.              cd %de                            ;; change into found dir       |                                                                     |
  7225.              gosub search                      ;; recurse to us for each dir       |                                                                     |
  7226.  
  7227.  
  7228.                                           114
  7229.  
  7230.  
  7231.                                                     Macro Language - Examples
  7232.        ----------------------------------------------------------------------
  7233.  
  7234.  
  7235.              cd ..                             ;; return to prev directory       |                                                                     |
  7236.            enddo                               ;;end of do block       |                                                                     |
  7237.            return                              ;;return from this procedure       |                                                                     |
  7238.        |                                                                     |
  7239.         ;-------------------------------------------------------------------       |                                                                     |
  7240.         :DISPLAY_SCREEN                        ;; Redraw Main screen       |                                                                     |
  7241.                                                ;;---------------------------       |                                                                     |
  7242.        |                                                                     |
  7243.            cls 3,1,176                         ;;clear the screen       |                                                                     |
  7244.            csroff                              ;;turn cursor off       |                                                                     |
  7245.            window 1,1,3,80,1,3,1,1             ;;display top box on screen       |                                                                     |
  7246.            cposn ,40                           ;;position to screen center       |                                                                     |
  7247.            echoc Macro File Search             ;;display screen title       |                                                                     |
  7248.            rstwin /n                           ;;free window, leave screen       |                                                                     |
  7249.            window 6,5,23,76,15,1,11,1          ;;display main window       |                                                                     |
  7250.            menucolor 15,4,0,14,2               ;;set menu color for prompts       |                                                                     |
  7251.            return                              ;;return with window active       |                                                                     |
  7252.        |                                                                     |
  7253.         ;-------------------------------------------------------------------       |                                                                     |
  7254.         :DISPLAY_PAUSE                         ;; Display Pause Message       |                                                                     |
  7255.                                                ;;---------------------------       |                                                                     |
  7256.        |                                                                     |
  7257.            echo                                ;;drop a line       |                                                                     |
  7258.            if %cl>%w3 echo %(32);              ;;if win is full, scroll it       |                                                                     |
  7259.            savvid                              ;;sav vid state on win stack       |                                                                     |
  7260.            cposn %w3,%w2-1                     ;;position at bottom of win       |                                                                     |
  7261.            color 7,0/r                         ;;set rev video, blk on wht       |                                                                     |
  7262.            ceol                                ;;clear current line in it       |                                                                     |
  7263.            cposn ,%w4-%w2/2+%w2                ;;position to center of win       |                                                                     |
  7264.              echoc Press Return to Continue;   ;;display prompt       |                                                                     |
  7265.            %k=                                 ;;reset last key pressed       |                                                                     |
  7266.            do while %k<>%(27) .and. %k<>%(13)  ;;while not Esc or Ret       |                                                                     |
  7267.              %k=%kb                            ;; %k = next keypress       |                                                                     |
  7268.            enddo                               ;;loop if not Esc or Ret       |                                                                     |
  7269.            rstvid                              ;;restore previous colors       |                                                                     |
  7270.            savvid                              ;;save video state again       |                                                                     |
  7271.            cposn %w3,%w2-1                     ;;position at bottom of win       |                                                                     |
  7272.            ceol                                ;;clear off our prompt text       |                                                                     |
  7273.            rstvid                              ;;restore video state       |                                                                     |
  7274.            return                              ;;return to caller       |                                                                     |
  7275.        `---------------------------------------------------------------------'
  7276.  
  7277.        Since this  example macro  file is  designed to return to the previous
  7278.        macro file  when it  finishes  searching,  and  thus  has  no  regular
  7279.        function key  definitions, a  little extra effort is necessary to trap
  7280.        errors and  the Escape  key so  that the  [FILEAUTO] definition  can't
  7281.        terminate unexpectedly,  leaving this  macro  file  active  because  a
  7282.        RETURN command wasn't issued.
  7283.  
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.                                           115
  7290.  
  7291.  
  7292.                                             Macro Language - Technical Tricks
  7293.        ----------------------------------------------------------------------
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.                                Macro Technical TricksMacro Technical Tricks
  7300.  
  7301.        This section  is provided to further augment the technically inclined.
  7302.        It discusses  some tricks  that may  be well  beyond average  use.  If
  7303.        while browsing  through this  section some  of the material leaves you
  7304.        somewhat mystified, don't lose any sleep over it.
  7305.  
  7306.  
  7307.                        Testing on the Extension of a FilenameTesting on the Extension of a Filename
  7308.  
  7309.        Occasionally it  is useful to test on the extension of a selected file
  7310.        or tagged  file to  make sure its of the type that the macro key deals
  7311.        with.   This can  be done  by using a combination of the two variables
  7312.        that return the filename with and without its extension.  For example:
  7313.  
  7314.             IF %FE<>%FN.ZIP ECHO File is Not a .ZIP File.
  7315.  
  7316.                  - or for tagged files -
  7317.  
  7318.             IF %TE<>%TN.ZIP ECHO File is Not a .ZIP File.
  7319.  
  7320.  
  7321.                     Collecting Tagged Filenames into a Temp VarCollecting Tagged Filenames into a Temp Var
  7322.  
  7323.        ,---------------------------------------------------------------------,
  7324.         [F1] ZIP TAGGED FILES/w                ;;TITLE LINE AND SWITCHES       |                                                                     |
  7325.              GET %FILE Enter Zip Filename:     ;;GET DEST FILENAME IN %FILE       |                                                                     |
  7326.              :LABEL1                           ;;LABEL FOR LOOP       |                                                                     |
  7327.                %LIST=%LIST %TE                 ;; %LIST=ITSELF+NEXT TAG FILE       |                                                                     |
  7328.                IF %SL(%LIST)>110 THEN          ;; IF LONGER THAN 110 CHARS       |                                                                     |
  7329.                  BEEP                          ;;  BEEP       |                                                                     |
  7330.                  MENU Command Line Length Exceeded  ;;  USE MENU TO DISPLAY       |                                                                     |
  7331.                   .Press Return to Continue    ;;  THE ERROR       |                                                                     |
  7332.                  EXIT                          ;;  AND EXIT       |                                                                     |
  7333.                ENDIF                           ;; END OF IF BLOCK       |                                                                     |
  7334.              LOOP LABEL1                       ;;LOOP THROUGH TAGGED FILES       |                                                                     |
  7335.              PKZIP -EX %FILE %LIST             ;;ZIP THE TAGGED FILES       |                                                                     |
  7336.        `---------------------------------------------------------------------'
  7337.  
  7338.        Occasionally, it is useful to collect the tagged filenames into a user
  7339.        variable so  that they can be processed simultaneously rather than re-
  7340.        executing a program several times with a different filename in a loop.
  7341.        In the  example above, %LIST is added with itself plus the next tagged
  7342.        filename (%TE)  until all tagged filenames have been added to %LIST by
  7343.        the loop.   There  is a limitation though.  MS-DOS only provides for a
  7344.        maximum command  line length  of 128  bytes (which  is the size of its
  7345.        field in  the PSP), which is why the string length of %LIST is checked
  7346.        every time  its expanded.   A  value of  110 was  used instead  of 128
  7347.  
  7348.  
  7349.  
  7350.                                           116
  7351.  
  7352.  
  7353.                                             Macro Language - Technical Tricks
  7354.        ----------------------------------------------------------------------
  7355.  
  7356.  
  7357.        because when  we run PKZIP, we're also passing it a filename in %FILE,
  7358.        and using some other switches.
  7359.  
  7360.  
  7361.                          Executing Other than .COM or .EXEExecuting Other than .COM or .EXE
  7362.  
  7363.        If you rename the extension of a executable program to something other
  7364.        than .COM  or .EXE, it is still possible to execute the program with a
  7365.        macro key,  as long  as you  include the  extension with the program's
  7366.        name on  the macro  line that runs it.  This would allow you to rename
  7367.        potentially dangerous programs so that they can't be executed from the
  7368.        MS-DOS command  prompt, but  can  still  be  used  in  the  controlled
  7369.        environment of a macro key.
  7370.  
  7371.        For instance,  if you  wanted to restrict people from using the MS-DOS
  7372.        format command  unless its  run by  a  macro  key,  you  could  rename
  7373.        FORMAT.EXE to something like FORMAT.PRG (which would not be considered
  7374.        executable by  any other  shell since it now does not end with a .COM,
  7375.        .EXE, or  .BAT extension) and then run it from a macro key by spelling
  7376.        out its full name (e.g. FORMAT.PRG A:/4).
  7377.  
  7378.  
  7379.                             Temporarily Changing COMSPECTemporarily Changing COMSPEC
  7380.  
  7381.        ,---------------------------------------------------------------------,
  7382.         [F1] TELIX                             ;;TITLE LINE AND SWITCHES       |                                                                     |
  7383.              CDD C:\TELIX                      ;;CHANGE DRIVE & DIRS       |                                                                     |
  7384.              %OLD_COMSPEC=%[COMSPEC]%OLD_COMSPEC=%[COMSPEC]           ;;%OLD_COMSPEC=ORIG COMSPEC       |                                                                     |
  7385.              SET COMSPEC=C:\DCOM\DCOM.COMSET COMSPEC=C:\DCOM\DCOM.COM      ;;COMSPEC=DCOM       |                                                                     |
  7386.              TELIX                             ;;RUN TELIX       |                                                                     |
  7387.              SET COMSPEC=%SET COMSPEC=%OLD_COMSPEC          ;;RESTORE ORIGINAL COMSPEC       |                                                                     |
  7388.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  7389.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  7390.        `---------------------------------------------------------------------'
  7391.  
  7392.        Occasionally, it  may be  desirable to temporarily change the contents
  7393.        of an  environment variable such as COMSPEC or PATH.  This can be done
  7394.        by saving  its original  value in a user variable before modifying the
  7395.        particular environment variable.
  7396.  
  7397.        A lot  of programs  use the  COMSPEC variable  to run a second copy of
  7398.        COMMAND.COM when  they "Drop  to DOS".   Sometimes you can temporarily
  7399.        change COMSPEC to point to your favorite shell rather than COMMAND.COM
  7400.        so that  when the program thinks its shelling out to DOS, its actually
  7401.        running another copy of your favorite shell.  In this example, we used
  7402.        %OLD_COMSPEC to temporarily hold the contents of the COMSPEC variable.
  7403.        Then, we changed COMSPEC to point to dCOM so that when the Alt-J (Jump
  7404.        to DOS)  command of  Telix is  invoked, instead of running COMMAND.COM
  7405.        and giving  you the  DOS prompt, it runs a second copy of dCOM.  After
  7406.        Telix terminates,  the COMSPEC  variable is  restored to  its original
  7407.        contents held in %OLD_COMSPEC.
  7408.  
  7409.  
  7410.  
  7411.                                           117
  7412.  
  7413.  
  7414.                                             Macro Language - Technical Tricks
  7415.        ----------------------------------------------------------------------
  7416.  
  7417.  
  7418.                         Appending to an Environment VariableAppending to an Environment Variable
  7419.  
  7420.        You can  easily append  to the  current  contents  of  an  environment
  7421.        variable by using the following technique:
  7422.  
  7423.             SET  PATH=%[PATH];C:\UTILITYS
  7424.  
  7425.        In this  example  the  PATH  environment  variable  is  appended  with
  7426.        "C:\UTILITYS" by setting it with itself plus the text we want to add.
  7427.  
  7428.        This example  is provided  mainly to  demonstrate how  to do this with
  7429.        environment variables.  The macro language actually provides an easier
  7430.        way to  append entries  to the  environment path  by using its PATHADD
  7431.        command.
  7432.  
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.  
  7470.  
  7471.  
  7472.                                           118
  7473.  
  7474.  
  7475.  
  7476.  
  7477.  
  7478.  
  7479.  
  7480.  
  7481.  
  7482.  
  7483.  
  7484.        ======================================================================
  7485.  
  7486.                                       MENUINGMENUING
  7487.  
  7488.        ======================================================================
  7489.  
  7490.  
  7491.  
  7492.  
  7493.  
  7494.  
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.  
  7532.  
  7533.                                           119
  7534.  
  7535.  
  7536.                                                            Menuing - Overview
  7537.        ----------------------------------------------------------------------
  7538.  
  7539.  
  7540.  
  7541.  
  7542.  
  7543.                                   Menuing OverviewMenuing Overview
  7544.  
  7545.        dCOM didn't  originally start  out with  the  intent  of  providing  a
  7546.        powerful menu system.  But one thing lead to another....
  7547.  
  7548.        What  dCOM   did  originally  start  with  was  a  very  simple  macro
  7549.        capability.   Well..., the macro capability has grown a lot since then
  7550.        and is  now a  powerful language.   So  it soon  became clear  that an
  7551.        option was  needed that  allowed the macro keys to be easily presented
  7552.        as a front-end menu.
  7553.  
  7554.        This is  where the  menu mode  comes in.   When dCOM is started in the
  7555.        menu mode  (instead of  starting as  a file  handler),  it  starts  up
  7556.        displaying a  menu of  the 20 function key titles in the current macro
  7557.        file.   Each of  the 20  function keys  can be  configured  to  run  a
  7558.        particular program,  or branch  off to  a new macro file and display a
  7559.        whole new  menu of  options, or  anything else you can make a function
  7560.        key definition do.
  7561.  
  7562.        The default  appearance of  the menu  mode takes  a rather  "straight-
  7563.        arrow" approach,  by showing  the  title  of  the  active  macro  file
  7564.        centered above  each of  its macro  key titles.   There  are plenty of
  7565.        options though which let you customize it.  For more information refer
  7566.        to Controlling Menu Appearance on page 122.
  7567.  
  7568.                ,---------------------------------------------------,
  7569.                |                     MAIN MENU                     |
  7570.                |---------------------------------------------------|
  7571.                | F1  | Wordperfect          | Tutorials            |
  7572.                | F2  | Microsoft Word       | -------------------- |
  7573.                | F3  | -------------------- | Communications       |
  7574.                | F4  | dBase                | Financial Mgmt       |
  7575.                | F5  | -------------------- | -------------------- |
  7576.                | F6  | Harvard Graphics     | Format a Disk        |
  7577.                | F7  | Lotus 1-2-3          | Copy a Disk          |
  7578.                | F8  | Quatro Pro           | Search for a File    |
  7579.                | F9  | -------------------- | -------------------- |
  7580.                | F10 | Windows              | Ship Hard Drives     |
  7581.                `---------------------------------------------------'
  7582.  
  7583.        Underneath this  simple looking  menu though  are a  lot  of  powerful
  7584.        features.   For instance, the whole thing is natively mouse sensitive.
  7585.        You can  execute a  function key  by clicking the mouse left button on
  7586.        its title.  The right mouse button escapes gosub'd menu's or exits the
  7587.        menu mode.   You  can also  execute function  keys by using the cursor
  7588.        keys to  select the  title desired  and press  Return.   Function  key
  7589.        titles can  also be  highlighted by pressing the first letter of their
  7590.        text.   When the  right key is highlighted, press Return.  Or, you can
  7591.        just press the appropriate function key.
  7592.  
  7593.  
  7594.                                           120
  7595.  
  7596.  
  7597.                                                           Menuing - Menu Mode
  7598.        ----------------------------------------------------------------------
  7599.  
  7600.  
  7601.  
  7602.  
  7603.  
  7604.                                    The Menu ModeThe Menu Mode
  7605.  
  7606.        The menu  mode is  activated by  using the /M command line switch when
  7607.        you run dCOM.
  7608.  
  7609.        dCOM continues  to stay  in the menu mode unless the root (first) menu
  7610.        is escaped.  When the menu mode is escaped, the file handler activates
  7611.        allowing you to quickly go find a file, copy a file, etc....  When you
  7612.        need to return to the menu mode, you simply press Escape again.
  7613.  
  7614.        ,---------------------------------------------------------------------,
  7615.         NOTE: If the  login system  is active,  some users  may not have the       |                                                                     |
  7616.               option of escaping the menu mode.       |                                                                     |
  7617.        `---------------------------------------------------------------------'
  7618.  
  7619.        Basically all there is to the menu mode is that you're telling dCOM to
  7620.        start up  with a menu of the macro key titles on the screen.  When you
  7621.        select an option - you're running a macro key.  Typically, these would
  7622.        be simple macro keys that just run programs.  But that doesn't have to
  7623.        stop you....
  7624.  
  7625.        Building layered  (multiple)  menu's  is  performed  using  GOTOMF  or
  7626.        GOSUBMF macro  commands, which  cause another  macro file  to load and
  7627.        become the  active macro  file.   The difference  between  GOTOMF  and
  7628.        GOSUBMF is  that GOSUBMF  saves the  current macro filename on a gosub
  7629.        stack, which can later be returned to using a macro RETURN command (or
  7630.        pressing Escape  from the menu).  GOTOMF only changes the active macro
  7631.        file.   The gosub  stack can  hold approximately  9 levels  of gosub'd
  7632.        menus.
  7633.  
  7634.        GOSUBMF is  the normal  method of  building layered  menu's because it
  7635.        provides an  easy mechanism  to return to the previous macro file.  It
  7636.        also has an optional switch (/C) that causes the new macro file's menu
  7637.        to display  cascaded one  level down and to the right so that the user
  7638.        can keep track of where they are in the menu structure.
  7639.  
  7640.        ,---------------------------------------------------------------------,
  7641.         NOTE: When the  menu mode  is active, you cannot use macro keys that       |                                                                     |
  7642.               were written  to use  the %FN,  %FE, %TN,  %TE, and  %TC macro       |                                                                     |
  7643.               variables.  These variables allow a macro key to interact with       |                                                                     |
  7644.               the file  handler by  returning the names of the selected file       |                                                                     |
  7645.               or tagged  files, but  they are meaningless when the menu mode       |                                                                     |
  7646.               is active.       |                                                                     |
  7647.        `---------------------------------------------------------------------'
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653.  
  7654.  
  7655.                                           121
  7656.  
  7657.  
  7658.                                         Menuing - Controlling Menu Appearance
  7659.        ----------------------------------------------------------------------
  7660.  
  7661.  
  7662.  
  7663.  
  7664.  
  7665.                             Controlling Menu AppearanceControlling Menu Appearance
  7666.  
  7667.        As mentioned  previously, the  default appearance  of the menu mode is
  7668.        somewhat on  the 'plain Jane' side.  If you're inclined to spiff it up
  7669.        a little  more to  your liking,  there is  a special macro definition,
  7670.        [MENUAUTO], which  lets you  customize the  appearance of  the  screen
  7671.        displayed.
  7672.  
  7673.        [MENUAUTO] is  a macro definition that executes just prior to when the
  7674.        menu will be displayed.  In it, you can use macro commands that; clear
  7675.        the screen  in a  color more suiting your taste, display other windows
  7676.        of information, and override the color of the menu itself.
  7677.  
  7678.        For example:
  7679.  
  7680.        ,---------------------------------------------------------------------,
  7681.         MAIN MACRO'S                           ;;MENU TITLE       |                                                                     |
  7682.        |                                                                     |
  7683.         [MENUAUTO]                             ;;RUNS BEFORE MENU DISPLAYS       |                                                                     |
  7684.              CLS 0,1,176                       ;;CLS IN BLACK ON BLUE w/'░'       |                                                                     |
  7685.              WINDOW 1,1,4,80,1,7,1,1           ;;DISPLAY A BOX ON THE SCREEN       |                                                                     |
  7686.                                                ;; AND THEN DISPLAY VERSION       |                                                                     |
  7687.              ECHO dCOM Menu System Ver %SS(%DV,1,1).%SS(%DV,2,2);       |                                                                     |
  7688.              CPOSN ,78                         ;;POSITION TO RIGHT EDGE       |                                                                     |
  7689.                                                ;; THEN DISPLAY DATE & TIME       |                                                                     |
  7690.              ECHOR %DW, %MY %SS(%DT,4,2), 19%SS(%DT,7,2)  %TI;       |                                                                     |
  7691.              CLOCK %CL,%CC-8                   ;;TURN CLOCK ON       |                                                                     |
  7692.              CPOSN 3,3                         ;;MOVE CURSOR TO NEXT LINE       |                                                                     |
  7693.              ECHO Current User %LN;            ;;DISPLAY USER NAME       |                                                                     |
  7694.              CPOSN ,78                         ;;POSITION TO RIGHT EDGE       |                                                                     |
  7695.                                                ;; THEN DISP FREE DISK SPACE       |                                                                     |
  7696.              ECHOR %FC(%FD(C)) Free of %FC(%TD(C)) On Drive C:       |                                                                     |
  7697.              RSTWIN /N                         ;;FREE WINDOW, LEAVE SCREEN       |                                                                     |
  7698.              MENUSTART 8,14                    ;;SET MENU DISPLAY POSITION       |                                                                     |
  7699.              MENUCOLOR 0,3,1,14,2              ;;SET MENU COLORS/BORDER TYPE       |                                                                     |
  7700.        |                                                                     |
  7701.         [F1] MS-WORD                           ;;TITLE LINE AND SWITCHES       |                                                                     |
  7702.              CDD C:\MSWORD                     ;;CHANGE DRIVE & DIRECTORIES       |                                                                     |
  7703.              WORD                              ;;RUN MS-WORD       |                                                                     |
  7704.              CD C:\                            ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  7705.              CDDO                              ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  7706.              .       |                                                                     |
  7707.              .       |                                                                     |
  7708.        `---------------------------------------------------------------------'
  7709.  
  7710.        If you  gosub other menu's (macro files) from a macro file that uses a
  7711.        [MENUAUTO] definition,  the gosub'd  macro files should also contain a
  7712.        copy of  the same  [MENUAUTO] definition (especially if the [MENUAUTO]
  7713.        definition contains a MENUSTART command).
  7714.  
  7715.  
  7716.                                           122
  7717.  
  7718.  
  7719.                                                       Menuing - Include Files
  7720.        ----------------------------------------------------------------------
  7721.  
  7722.  
  7723.  
  7724.  
  7725.  
  7726.                                    Include FilesInclude Files
  7727.  
  7728.        Having a  bunch of  macro files  that  all  use  the  same  [MENUAUTO]
  7729.        definition however,  could become a little difficult to maintain (like
  7730.        when you  suddenly decide you'd rather use a different set of colors).
  7731.        So you  may want  to put the [MENUAUTO] definition off in its own file
  7732.        and then INCLUDE it in each macro file that needs it.
  7733.  
  7734.        For example:
  7735.  
  7736.        ,---------------------------------------------------------------------,
  7737.         ;===================================================================       |                                                                     |
  7738.         ;                             DCOM.MAC       |                                                                     |
  7739.         ;-------------------------------------------------------------------       |                                                                     |
  7740.         INCLUDE MENUAUTO.INC         ;;INCL [MENUAUTO] DEFINITION       |                                                                     |
  7741.        |                                                                     |
  7742.         [F1] MS-WORD                 ;;TITLE LINE AND SWITCHES       |                                                                     |
  7743.            CDD C:\MSWORD             ;;CHANGE DRIVE & DIRECTORIES       |                                                                     |
  7744.            WORD                      ;;RUN MS-WORD       |                                                                     |
  7745.            CD C:\                    ;;CHANGE C: BACK TO ROOT DIR       |                                                                     |
  7746.            CDDO                      ;;RETURN TO ORIG DRIVE & DIR       |                                                                     |
  7747.        |                                                                     |
  7748.            .       |                                                                     |
  7749.            .       |                                                                     |
  7750.        |                                                                     |
  7751.        `---------------------------------------------------------------------'
  7752.  
  7753.        ,---------------------------------------------------------------------,
  7754.         ;===================================================================       |                                                                     |
  7755.         ;                             MENUAUTO.INC       |                                                                     |
  7756.         ;-------------------------------------------------------------------       |                                                                     |
  7757.         ; Description:       |                                                                     |
  7758.         ;       |                                                                     |
  7759.         ;   This is the standard [MENUAUTO] definition.  This file is       |                                                                     |
  7760.         ;   INCLUDE'd by all macro files which need it.       |                                                                     |
  7761.         ;       |                                                                     |
  7762.         ;-------------------------------------------------------------------       |                                                                     |
  7763.         [MENUAUTO]                        ;;RUNS BEFORE MENU DISPLAYS       |                                                                     |
  7764.            CLS 0,1,176                    ;;CLS IN BLACK ON BLUE w/'░'       |                                                                     |
  7765.            WINDOW 1,1,4,80,1,7,1,1        ;;DISPLAY A BOX ON THE SCREEN       |                                                                     |
  7766.                                           ;; AND THEN DISPLAY VERSION       |                                                                     |
  7767.            ECHO dCOM Menu System Version %SS(%DV,1,1).%SS(%DV,2,2);       |                                                                     |
  7768.            CPOSN ,78                      ;;POSITION TO RIGHT EDGE       |                                                                     |
  7769.                                           ;; THEN DISPLAY DATE & TIME       |                                                                     |
  7770.            ECHOR %DW, %MY %SS(%DT,4,2), 19%SS(%DT,7,2)  %TI;       |                                                                     |
  7771.            CLOCK %CL,%CC-8                ;;TURN CLOCK ON       |                                                                     |
  7772.            CPOSN 3,3                      ;;MOVE CURSOR TO NEXT LINE       |                                                                     |
  7773.            ECHO Current User %LN;         ;;DISPLAY USER NAME       |                                                                     |
  7774.            CPOSN ,78                      ;;POSITION TO RIGHT EDGE       |                                                                     |
  7775.  
  7776.  
  7777.                                           123
  7778.  
  7779.  
  7780.                                                       Menuing - Include Files
  7781.        ----------------------------------------------------------------------
  7782.  
  7783.  
  7784.                                           ;; THEN DISP FREE DISK SPACE       |                                                                     |
  7785.            ECHOR %FC(%FD(C)) Free of %FC(%TD(C)) On Drive C:       |                                                                     |
  7786.            RSTWIN /N                      ;;FREE WINDOW, LEAVE SCREEN       |                                                                     |
  7787.            MENUSTART 8,14                 ;;SET MENU DISPLAY POSITION       |                                                                     |
  7788.            MENUCOLOR 0,3,1,14,2           ;;SET MENU COLORS/BORDER TYPE       |                                                                     |
  7789.        `---------------------------------------------------------------------'
  7790.  
  7791.        There is  one drawback  though to using included files.  dCOM does not
  7792.        automatically recognize  when changes  have  been  made  only  to  the
  7793.        include file.  Its means of detecting whether the .CMF file is current
  7794.        is to  compare the  date stamp of the .MAC file against its .CMF file.
  7795.        It has  no way  of knowing that a .MAC's .CMF file was also built from
  7796.        files other than the .MAC file.
  7797.  
  7798.        If you  change an  included file  without changing  the .MAC file that
  7799.        calls it,  the changes  won't take effect until something modifies the
  7800.        date stamp  of the  .MAC file, or you use the macro RECOMPILE command.
  7801.        For example:
  7802.  
  7803.        ,---------------------------------------------------------------------,
  7804.         [F1] RECOMPILE MACROS                  ;;TITLE LINE AND SWITCHES       |                                                                     |
  7805.              RECOMPILE *.MAC /v                ;;RECOMPILE ALL .MAC FILES       |                                                                     |
  7806.        `---------------------------------------------------------------------'
  7807.  
  7808.  
  7809.        Based on  this, using  included files would appear to be an attractive
  7810.        option mainly  when the  contents of  the included file are relatively
  7811.        stable.
  7812.  
  7813.        Although our  discussion on  using include  files so  far has  been in
  7814.        conjunction with [MENUAUTO], you can easily throw other definitions in
  7815.        an include  file as  well.   For instance, a set of common subroutines
  7816.        could be  built under a [PUBLIC] definition, which sits off in another
  7817.        file and  is included  by macro's that need access to the subroutines.
  7818.        The same  goes for  using values  that need  to be  consistent  across
  7819.        several macro  files by building them under a [EQUATES] definition and
  7820.        then including them in each macro file.
  7821.  
  7822.  
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.  
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835.  
  7836.  
  7837.  
  7838.                                           124
  7839.  
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.  
  7849.  
  7850.        ======================================================================
  7851.  
  7852.                                    ACCESS CONTROLACCESS CONTROL
  7853.  
  7854.        ======================================================================
  7855.  
  7856.  
  7857.  
  7858.  
  7859.  
  7860.  
  7861.  
  7862.  
  7863.  
  7864.  
  7865.  
  7866.  
  7867.  
  7868.  
  7869.  
  7870.  
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876.  
  7877.  
  7878.  
  7879.  
  7880.  
  7881.  
  7882.  
  7883.  
  7884.  
  7885.  
  7886.  
  7887.  
  7888.  
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.                                           125
  7900.  
  7901.  
  7902.                                                     Access Control - Overview
  7903.        ----------------------------------------------------------------------
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.                               Access Control OverviewAccess Control Overview
  7910.  
  7911.        If we could all trust one another wouldn't life be great....
  7912.  
  7913.        But sometimes  we don't,  especially with  our own  personal computer.
  7914.        dCOM's access  control (login)  system allows  you to define each user
  7915.        that needs to access the computer, and just what they can do when they
  7916.        use dCOM.
  7917.  
  7918.        Individual rights  control what  the user can do while they are in the
  7919.        file handler  (or if  they can access the file handler at all).  These
  7920.        are things  like whether  the user  can open files (copying, printing,
  7921.        editing, etc...), modify files (delete, rename, move, hide, or editing
  7922.        w/save), change configurations, save configurations, run programs, and
  7923.        view hidden files.
  7924.  
  7925.        Groups can  be used  to restrict certain menu (macro) options based on
  7926.        whether the  user belongs to a group in the set specified by a macro's
  7927.        /G title line switch.
  7928.  
  7929.        You can  also enable the access control system with several additional
  7930.        features.   One of  them automatically logs the user out if the screen
  7931.        saver times  out due  to inactivity.   Another  feature  automatically
  7932.        blanks the screen and locks the keyboard (until the user retypes their
  7933.        password), if the screen saver times out.
  7934.  
  7935.        Enabling the access control system can serve a variety of needs.  Some
  7936.        people may just wish to have their computer password protected when it
  7937.        is first  turned on.   Others,  may have  more of  a concern with what
  7938.        capabilities are  available to  other users using their computer.  Or,
  7939.        from a menuing perspective, what menu functions are available to which
  7940.        users.   And lastly,  maybe just  keeping track  of usage (which users
  7941.        were on  when and  what programs  they ran)  by  also  activating  the
  7942.        activity log with the /A command line switch..
  7943.  
  7944.        Aside from physical or hardware security measures, most software-based
  7945.        passwording systems  are penetrable  in one  way or  another.   dCOM's
  7946.        access control  system is  most effective  when you  load dCOM  as the
  7947.        primary shell with a SHELL= statement in CONFIG.SYS.  This pretty much
  7948.        covers all  bases except  booting off a floppy, because the CONFIG.SYS
  7949.        file can't be aborted with a CtrlC.
  7950.  
  7951.        The access  control system  wasn't intended  to be  an absolutely fool
  7952.        proof solution  to keeping  out unwanted hackers.  But it is real good
  7953.        at keeping honest users honest.
  7954.  
  7955.        You can  provide users  an option to change their password by using an
  7956.        undocumented command.
  7957.  
  7958.  
  7959.  
  7960.                                           126
  7961.  
  7962.  
  7963.                                                     Access Control - Enabling
  7964.        ----------------------------------------------------------------------
  7965.  
  7966.  
  7967.  
  7968.  
  7969.  
  7970.                               Enabling Access ControlEnabling Access Control
  7971.  
  7972.        Running dCOM with the access control system enabled is done by passing
  7973.        it a /L, or /LA command line switch.
  7974.  
  7975.        The /L switch enables the basic access control system.  The /LA switch
  7976.        enables the  access control  system with an automatic time-out feature
  7977.        that logs the user out if the computer is inactive long enough to trip
  7978.        the screen saver.
  7979.  
  7980.        ,---------------------------------------------------------------------,
  7981.         NOTE: In order  for the automatic logout feature to activate, dCOM's       |                                                                     |
  7982.               screen saver must be enabled.  Also, the automatic logout only       |                                                                     |
  7983.               occurs if  the file handler or menu mode are currently active.       |                                                                     |
  7984.               If an  external application  is active,  only the screen saver       |                                                                     |
  7985.               will activate.       |                                                                     |
  7986.        `---------------------------------------------------------------------'
  7987.  
  7988.        When you  run dCOM,  there are  several ways  to pass  it command line
  7989.        switches.     If  you   use  the  DCOM  environment  variable  or  the
  7990.        SWITCHES.SYS file,  to specify the /L or /LA switches, the effect will
  7991.        be that  if you exit dCOM and rerun it, the access control system will
  7992.        still be active and the login prompt will be reissued.
  7993.  
  7994.        If these  switches are  passed on  the command  line that runs dCOM in
  7995.        AUTOEXEC.BAT, the  first time  dCOM runs  you will  be prompted  for a
  7996.        login name,  but if  you exit  dCOM for one reason or another and then
  7997.        rerun it,  the login system won't be active the 2nd time and you won't
  7998.        be prompted to login again.
  7999.  
  8000.        Both of  the login  command line  switches also accept parameters that
  8001.        allow you to include a default user's name and password.  (Giving both
  8002.        the user name and password is somewhat self-defeating though.)
  8003.  
  8004.        The full syntax of the access control switches is:
  8005.  
  8006.             /L[:name][,password]
  8007.             /LA[:name][,password]
  8008.  
  8009.        If a default name is included with these switches and that name in the
  8010.        Access Control  Menu's user  list has  no  password,  the  login  will
  8011.        proceed automatically without displaying a login prompt, otherwise the
  8012.        default name  is filled  in and  the login prompt starts up asking for
  8013.        the password.
  8014.  
  8015.        If a  default name  is included  that doesn't  exist in the user list,
  8016.        dCOM will  attempt to  automatically proceed  and log  the user  in as
  8017.        GUEST.
  8018.  
  8019.  
  8020.  
  8021.                                           127
  8022.  
  8023.  
  8024.        Access Control - Logging In
  8025.        ----------------------------------------------------------------------
  8026.  
  8027.  
  8028.  
  8029.  
  8030.  
  8031.                              Access Control Logging InAccess Control Logging In
  8032.  
  8033.        When the  access control  system is enabled, the first thing dCOM does
  8034.        when it starts up is prompt for the user to log in.
  8035.  
  8036.        Whether an  unknown name  is allowed  to log in depends on whether you
  8037.        leave the  GUEST user  active in  the access control menu's user list.
  8038.        If  the   GUEST  user  is  not  deleted  from  the  user  list,  three
  8039.        unsuccessful login attempts will proceed with the user logged in under
  8040.        GUEST.   If the  GUEST user  is deleted,  the login  prompt  will  not
  8041.        proceed until a valid user is logged in.
  8042.  
  8043.        If the  user enters  a valid name which has no password entered in the
  8044.        user list,  dCOM will proceed to log the user in without prompting for
  8045.        a password.   If  the user  enters an invalid name, dCOM will act dumb
  8046.        and proceed  to prompt  for the  password, which  will of  course then
  8047.        fail.
  8048.  
  8049.        Successful login's are automatically logged to the log file (DCOM.LOG)
  8050.        if the Audit Trail feature is enabled (dCOM's /A command line switch).
  8051.  
  8052.  
  8053.                                   Active PasswordActive Password
  8054.  
  8055.        When the access control system is enabled, the active password is that
  8056.        of whoever  is logged in.  When the access control system is disabled,
  8057.        the active password is that of the SUPERVISOR's entry.
  8058.  
  8059.        Currently, the  active password  is only  used to  unblank  a  blanked
  8060.        screen.  The screen can be blanked and the keyboard locked at any time
  8061.        by pressing  the Shift-Ctrl-B  hotkey.   If dCOM's  /SB  command  line
  8062.        switch was  also specified  at start  up, the screen blanker will also
  8063.        activate when the screen saver times out.
  8064.  
  8065.  
  8066.  
  8067.  
  8068.  
  8069.  
  8070.  
  8071.  
  8072.  
  8073.  
  8074.  
  8075.  
  8076.  
  8077.  
  8078.  
  8079.  
  8080.  
  8081.  
  8082.                                           128
  8083.  
  8084.  
  8085.                                                  Access Control - Logging Out
  8086.        ----------------------------------------------------------------------
  8087.  
  8088.  
  8089.  
  8090.  
  8091.  
  8092.                              Access Control Logging OutAccess Control Logging Out
  8093.  
  8094.        An Alt-L  may be issued whenever the menu mode or file handler screens
  8095.        are active,  to log  the current user out and then display a prompt to
  8096.        log back in as a new user.
  8097.  
  8098.        If the  automatic logout  switch was  used (/LA)  and the screen saver
  8099.        trips due  to no  keyboard or  mouse activity, the user will be logged
  8100.        out automatically.  When the screen is restored (by pressing any key),
  8101.        the login  prompt will  then be  displayed.  (Automatic logouts may be
  8102.        inhibited by using the Shift-Ctrl-B hotkey to blank the screen.)
  8103.  
  8104.        Logging a user out can also be done during macro execution by using an
  8105.        undocumented command  in a  macro key.  Or, by configuring a macro key
  8106.        with the /L title line switch and just executing it.
  8107.  
  8108.        When a  logout occurs  with the  menu mode  enabled, but  the user had
  8109.        escaped back  to the  file handler,  if the  next user  that  logs  in
  8110.        doesn't  have   rights  to   the  file  handler  the  menu  mode  will
  8111.        automatically be reactivated.
  8112.  
  8113.        If an  automatic (screen  saver time-out)  logout occurs  while in the
  8114.        menu mode  and the  current macro  file is  a gosub'd macro file, dCOM
  8115.        will automatically return to the root macro file after a new user logs
  8116.        in (except if the next paragraph applies).
  8117.  
  8118.        If any  type of logout occurs and a macro file called LOGIN.MAC exists
  8119.        in dCOM's  Home Directory,  it will become the root macro file causing
  8120.        any gosub'd  macro files  to be discarded.  For more information refer
  8121.        to page 14.
  8122.  
  8123.        Internal hard  disks are  automatically parked (shipped) when a logout
  8124.        of any type occurs.
  8125.  
  8126.        Logouts are  automatically logged  to the  log file  (DCOM.LOG) if the
  8127.        Audit Trail feature is enabled (dCOM's /A command line switch).
  8128.  
  8129.  
  8130.  
  8131.  
  8132.  
  8133.  
  8134.  
  8135.  
  8136.  
  8137.  
  8138.  
  8139.  
  8140.  
  8141.  
  8142.  
  8143.                                           129
  8144.  
  8145.  
  8146.                                               Access Control - Administration
  8147.        ----------------------------------------------------------------------
  8148.  
  8149.  
  8150.  
  8151.  
  8152.  
  8153.                            Access Control AdministrationAccess Control Administration
  8154.  
  8155.        Configuring the  access control  system is  done in the file handler's
  8156.        Alt-A - Access Control Menu.
  8157.  
  8158.        When the access control system is enabled, only someone logged in as a
  8159.        supervisor or  junior supervisor may enter and edit the Access Control
  8160.        Menu.   If the  access control  system  is  not  enabled,  the  active
  8161.        password (which  will be  the SUPERVISOR's  password) will be prompted
  8162.        for (if its been set), before entry is allowed.
  8163.  
  8164.        If the  access control system is enabled and the user currently logged
  8165.        in is  not a  supervisor, pressing  Alt-A to invoke the Access Control
  8166.        Menu will  only display  a window  showing the  current  user's  name,
  8167.        rights, and groups.
  8168.  
  8169.        Under the  Access Control  Menu you  define a  list of users that will
  8170.        have access to the computer, and what privileges they will have.
  8171.  
  8172.        The  Access   Control  Menu   initially  defaults  with  two  entries,
  8173.        SUPERVISOR and  GUEST.   Both entries  play  a  role  under  different
  8174.        situations and shouldn't be deleted carelessly.
  8175.  
  8176.        The SUPERVISOR's  password is  used as  the active  password when  the
  8177.        access control  system is  not enabled.   One  of the  first orders of
  8178.        business should  be to  enter a  password for  the SUPERVISOR entry so
  8179.        that other users can't log in using its name.
  8180.  
  8181.        The GUEST  user controls  what rights  and groups an unknown user will
  8182.        have, if  it exists.  If you don't wish to allow invalid login's, then
  8183.        delete the  GUEST entry.  If there are a large number of users fitting
  8184.        a general  description of  "peon", instead of building all their names
  8185.        in the  user list,  you could  just tell them all to log as GUEST.  Be
  8186.        sure to  configure the  GUEST entry to only have the rights and groups
  8187.        with which you are comfortable if an unknown user is on your system.
  8188.  
  8189.        Normally, the primary supervisor would immediately add his/her name in
  8190.        the user  list and  give themselves  a group flag of "$" (making their
  8191.        name a  supervisor with  full access  to the  system).  If the primary
  8192.        supervisor wants  to further  delegate some junior supervisors, he/she
  8193.        would add  their names  to the user list and give them a group flag of
  8194.        "#", which  gives them  the same  full access as the supervisor except
  8195.        that they  cannot modify  other users  having  supervisor,  or  junior
  8196.        supervisor group flags.
  8197.  
  8198.  
  8199.  
  8200.  
  8201.  
  8202.  
  8203.  
  8204.                                           130
  8205.  
  8206.  
  8207.                                      Access Control - Administration - Rights
  8208.        ----------------------------------------------------------------------
  8209.  
  8210.  
  8211.  
  8212.  
  8213.  
  8214.                                        RightsRights
  8215.  
  8216.        User rights  control what capabilities a user has when they are in the
  8217.        file handler, or whether they can even access the file handler.
  8218.  
  8219.        F  - File HandlerF  - File Handler.  This right controls whether the user has access to
  8220.            the file  handler.   If a  user is not given this right, they will
  8221.            not be  allowed to escape the menu mode or, if the menu mode isn't
  8222.            active, they  will be  denied access to log in.  (Note: If you are
  8223.            preventing people  from accessing  the file  handler,  you  should
  8224.            ensure that the GUEST entry cannot do so either.)
  8225.  
  8226.        R  - Run ProgramsR  - Run Programs.  This right is required to run external programs or
  8227.            issue DOS commands.
  8228.  
  8229.        X  - ExitX  - Exit.  This right controls whether the user can exit dCOM.
  8230.  
  8231.        O  - Open FilesO  - Open Files.  This right  is required  to copy files, print files,
  8232.            edit or  browse files,  etc....  It basically controls whether the
  8233.            user can in any way read or view the contents of a file.
  8234.  
  8235.        M  - Modify FilesM  - Modify Files.  This right  is required  to delete  files,  rename
  8236.            files, move  files, edit  and save a file, change file attributes,
  8237.            etc....   It basically  controls whether  the user  can in any way
  8238.            change something related to files.
  8239.  
  8240.        C  - Change ConfigurationsC  - Change Configurations.  This right  is required  to  view  and/or
  8241.            change any of the configuration menus.
  8242.  
  8243.        S  - Save ConfigurationsS  - Save Configurations.  This right  is required to permanently save
  8244.            changes made to any of the configuration menus.
  8245.  
  8246.        V - View Hidden FilesV - View Hidden Files.  This right  is required  in order for the user
  8247.            to change the view mode to show hidden files.
  8248.  
  8249.  
  8250.  
  8251.  
  8252.  
  8253.  
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259.  
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.                                           131
  8266.  
  8267.  
  8268.                                      Access Control - Administration - Groups
  8269.        ----------------------------------------------------------------------
  8270.  
  8271.  
  8272.  
  8273.  
  8274.  
  8275.                                        GroupsGroups
  8276.  
  8277.        Groups are  a set  of one or more flags which you assign to each user.
  8278.        Some of  the group  flags can  also influence  user rights.  There are
  8279.        three different  types of  group flags;  Standard Groups (A...Z), Auto
  8280.        Rights (1...4), and supervisor ($ or #).
  8281.  
  8282.        Standard Group flags only apply to macro key definitions that use a /G
  8283.        title line  switch.  If a macro key uses the /G title line switch, the
  8284.        user must  also belong  to one  of the  groups listed  after the /G in
  8285.        order to access the macro key.
  8286.  
  8287.        For example:
  8288.  
  8289.        ,---------------------------------------------------------------------,
  8290.         Name       Groups       Sample Macro Definition       |                       |                                             |
  8291.        |-----------------------+---------------------------------------------|
  8292.         JOE        AB1          [F1] Personnel Data /G:AC       |                       |                                             |
  8293.         MIKE       C2                CDD C:\PERSONEL       |                       |                                             |
  8294.         PETE       B                 DBASE MYPROG       |                       |                                             |
  8295.         RALPH      BD2               CD C:\       |                       |                                             |
  8296.         SANDY      A1                CDDO       |                       |                                             |
  8297.        `---------------------------------------------------------------------'
  8298.  
  8299.        In the example above, Joe, Mike, and Sandy would have access to the F1
  8300.        key because one or more of their group flags contains either an "A" or
  8301.        "C".   Pete and  Ralph do  not, and when they are logged in the F1 key
  8302.        will appear blank.
  8303.  
  8304.        Use of the Standard Groups (A...Z) is purely arbitrary.  dCOM makes no
  8305.        significance on  their use  other  than  what  you  do  with  them  in
  8306.        conjunction with the macro /G title line switch.
  8307.  
  8308.        Auto Rights Group flags (1...4) are provided as a shortcut for quickly
  8309.        giving a  user some  pre-configured rights  in the  file handler.  For
  8310.        instance, if  you wanted  to give  someone File Handler, Open, and Run
  8311.        rights, all you could just give them a group "2" instead of turning on
  8312.        each of these rights individually.
  8313.  
  8314.        Supervisor group  flags ($ or #) automatically give a user full access
  8315.        to the  entire system.  The only difference is that the "$" group is a
  8316.        full  supervisor   and  the  "#"  is  a  junior  supervisor.    Junior
  8317.        supervisor's can't  change other  supervisor records  and can't create
  8318.        new supervisors.
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.                                           132
  8327.  
  8328.  
  8329.                                        Access Control - With the Macro System
  8330.        ----------------------------------------------------------------------
  8331.  
  8332.  
  8333.  
  8334.  
  8335.  
  8336.                         Access Control With the Macro SystemAccess Control With the Macro System
  8337.  
  8338.        The access  control system  can be  used to  control which  users  can
  8339.        access certain  macro keys.   Function keys are normally accessible to
  8340.        all users  unless they  are protected  with the  macro /G  title  line
  8341.        switch.  (This was just discussed on the previous page.)
  8342.  
  8343.        You can  provide menu  options to  log users  out  and  in  using  two
  8344.        different methods:
  8345.  
  8346.         *  You could  use an  undocumented command  which logs  the user out,
  8347.            clears the  screen, ships  the hard  drives, and  presents a login
  8348.            prompt for the next user.
  8349.  
  8350.         *  You can  configure a  macro key with a /L title line switch.  This
  8351.            switch provides  a quick  method of turning a macro key into means
  8352.            of logging users in and out of the access control system.
  8353.  
  8354.        ,---------------------------------------------------------------------,
  8355.         NOTE: Any time the menu mode is active, an Alt-L can also be pressed       |                                                                     |
  8356.               to logout  and log  back in  as a  new user.   This  option is       |                                                                     |
  8357.               supplied as  a fail-safe  measure  in  case  you're  currently       |                                                                     |
  8358.               logged in  as user  that doesn't  have file handler rights and       |                                                                     |
  8359.               for some inexplicable reason there aren't any macro options to       |                                                                     |
  8360.               log back in as a supervisor....       |                                                                     |
  8361.        `---------------------------------------------------------------------'
  8362.  
  8363.        When you  use the  /L title line switch on a macro key definition, the
  8364.        key becomes  a special  login/logout macro  key.  The macro definition
  8365.        need not  be followed  by executable  macro code (if it does, it won't
  8366.        execute), the presence of the switch alone is all that is required.
  8367.  
  8368.        When a  macro key  is executed  that has  a /L title line switch and a
  8369.        user is  currently logged  in, the  user is  logged out  and all other
  8370.        function key  titles disappear  (the menu  mode is now locked in place
  8371.        until a new user logs in).  When the same macro key is executed again,
  8372.        the login prompt for a new user is then displayed.
  8373.  
  8374.        Another feature  of the  /L title line switch is that the title of the
  8375.        macro  key   is  managed  for  you  (either  "Login"  or  "Logout"  is
  8376.        automatically displayed   depending  on what  the next  logical action
  8377.        should be).   The  only reason for entering a title with the /L switch
  8378.        is to  give dCOM  a  template  which  shows  whether  to  display  the
  8379.        automatic title in uppercase, lowercase, or some mix thereof.
  8380.  
  8381.        From within  a macro key you can access the currently logged user name
  8382.        with the %LN system variable.
  8383.  
  8384.  
  8385.  
  8386.  
  8387.                                           133
  8388.  
  8389.  
  8390.  
  8391.  
  8392.  
  8393.  
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.        ======================================================================
  8400.  
  8401.                                      APPENDICESAPPENDICES
  8402.  
  8403.        ======================================================================
  8404.  
  8405.  
  8406.  
  8407.  
  8408.  
  8409.  
  8410.  
  8411.  
  8412.  
  8413.  
  8414.  
  8415.  
  8416.  
  8417.  
  8418.  
  8419.  
  8420.  
  8421.  
  8422.  
  8423.  
  8424.  
  8425.  
  8426.  
  8427.  
  8428.  
  8429.  
  8430.  
  8431.  
  8432.  
  8433.  
  8434.  
  8435.  
  8436.  
  8437.  
  8438.  
  8439.  
  8440.  
  8441.  
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.                                           134
  8449.  
  8450.  
  8451.                                   Appendix A - Using Macro Files on a Network
  8452.        ----------------------------------------------------------------------
  8453.  
  8454.  
  8455.  
  8456.  
  8457.  
  8458.                     Appendix A - Using Macro Files on a NetworkAppendix A - Using Macro Files on a Network
  8459.  
  8460.        dCOM can  easily drive  a network  menu system  by having  the network
  8461.        macro files located in a public subdirectory on a network drive.  More
  8462.        on this in a little bit.
  8463.  
  8464.        dCOM generically  is very network friendly.  It always opens and reads
  8465.        files (like  its overlay  and macro  files) in read-only compatibility
  8466.        mode, which is normally considered shareable by most network operating
  8467.        systems.   Furthermore, it  almost always  reads files  with one quick
  8468.        read instruction  and then  immediately closes  them.   The window  of
  8469.        opportunity for  a conflict  is very  small, even  if a network didn't
  8470.        consider files opened for reading as shareable.
  8471.  
  8472.        dCOM never  has a  file open  when its  sitting static  waiting on the
  8473.        keyboard (or  mouse).   You can  always edit  macro files  placed on a
  8474.        network drive without worrying about file sharing problems.
  8475.  
  8476.        If your network operating system is Novell, dCOM has a powerful set of
  8477.        additional macro  commands and  system variables,  that let your macro
  8478.        keys operate  a lot  smarter about  who the current user is, who other
  8479.        users are, etc....  dCOM's macro language directly supports all of the
  8480.        login script  functions and  it does  it more  than 10  times  faster.
  8481.        Other macro  commands provide  access to the bindery directly, letting
  8482.        you DO  loops around any bindery object, or display menu selections of
  8483.        any bindery  type (e.g.  print servers,  print queues,  file  servers,
  8484.        users, groups,  etc...).    Documentation  on  these  capabilities  is
  8485.        supplied separately in a package called dCOM For NetWare.
  8486.  
  8487.        You can  install dCOM  on local  workstations and  easily configure  a
  8488.        local macro  key to  call the  network menu  by using  a macro GOSUBMF
  8489.        command.   The only  directory privilege  required in a shared network
  8490.        macro directory  is Read.  This keeps unwanted eyes from being able to
  8491.        view the  details of  your network  macro's because they probably will
  8492.        have no  idea what  the macro  filenames are (except for the first one
  8493.        called).
  8494.  
  8495.        Whenever you  use the  GOSUBMF command  to call  a macro  file on  the
  8496.        network, you  must specify  the full path to the macro file (otherwise
  8497.        dCOM will try to find the macro file in its Home Directory).
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.                                           135
  8510.  
  8511.  
  8512.                                   Appendix A - Using Macro Files on a Network
  8513.        ----------------------------------------------------------------------
  8514.  
  8515.  
  8516.  
  8517.        For example:
  8518.  
  8519.        ,---------------------------------------------------------------------,
  8520.         [F10]   NETWORK MENU                   ;;TITLE LINE AND SWITCHES       |                                                                     |
  8521.              IF NOT EXIST N:\NUL               ;;IF NETWORK DRV NOT PRESENT       |                                                                     |
  8522.                BEEP                            ;; BEEP       |                                                                     |
  8523.                MENU Not Logged into Network    ;; DISPLAY MESSAGE USING       |                                                                     |
  8524.                 .Press Return to Continue      ;;   MENU COMMAND       |                                                                     |
  8525.                EXIT                            ;; TERMINATE THE MACRO       |                                                                     |
  8526.              ENDIF                             ;;END OF IF BLOCK       |                                                                     |
  8527.              GOSUBMF N:\MENU\MAINMENU.MAC      ;;CALL THE NETWORK MENU MACRO       |                                                                     |
  8528.        `---------------------------------------------------------------------'
  8529.  
  8530.  
  8531.        On a  Novell network,  you can  use volume references instead of drive
  8532.        references when calling macro files (for that matter, you can use them
  8533.        almost everywhere else too).
  8534.  
  8535.        For example:
  8536.  
  8537.        ,---------------------------------------------------------------------,
  8538.         [F10]   NOVELL NETWORK MENU            ;;TITLE LINE AND SWITCHES       |                                                                     |
  8539.              IF %FS="" THEN                    ;;IF FILE SERVER NOT PRESENT       |                                                                     |
  8540.                BEEP                            ;; BEEP       |                                                                     |
  8541.                MENU Network Drivers Not Loaded ;; DISPLAY MESSAGE USING       |                                                                     |
  8542.                 .Press Return to Continue      ;;   MENU COMMAND       |                                                                     |
  8543.                EXIT                            ;; TERMINATE THE MACRO       |                                                                     |
  8544.              ENDIF                             ;;END OF IF BLOCK       |                                                                     |
  8545.              GOSUBMF SYS:MENU\MAINMENU.MAC     ;;CALL THE NETWORK MENU MACRO       |                                                                     |
  8546.        `---------------------------------------------------------------------'
  8547.  
  8548.        These examples  are not  meant to  be fully  working models.  They are
  8549.        provided mainly to exhibit a rough sketch of how it can be done.
  8550.  
  8551.        There is  one thing  to always  keep in  mind  on  a  network  though.
  8552.        Wherever you  put the  network .MAC  files is  where dCOM  will try to
  8553.        build their equivalent .CMF files (compiled macro files).
  8554.  
  8555.        If you  (the supervisor)  modify the .MAC file, you should immediately
  8556.        run that  macro file  so that  your network  access can build the .CMF
  8557.        file.   In all  likely hood,  the privileges you've granted to regular
  8558.        users won't let their access build the .CMF file.  (You should run the
  8559.        macro anyway just to test your changes.)
  8560.  
  8561.  
  8562.  
  8563.  
  8564.  
  8565.  
  8566.  
  8567.  
  8568.  
  8569.  
  8570.                                           136
  8571.  
  8572.  
  8573.                                   Appendix A - Using Macro Files on a Network
  8574.        ----------------------------------------------------------------------
  8575.  
  8576.  
  8577.  
  8578.        What happens  when a  .MAC file  has been  modified and is out of sync
  8579.        with its  .CMF file  under a  regular user's privileges, is that their
  8580.        copy of dCOM will detect that its out of sync and automatically invoke
  8581.        their macro  compiler (when  they attempt  to access  it),  the  macro
  8582.        compiler will  properly build  their memory image of the .MAC file but
  8583.        it won't  be able  to save  the .CMF  file.   When this  happens, dCOM
  8584.        doesn't produce  any superficial indication that it couldn't write the
  8585.        .CMF file.   The  only symptom  is that  access to  the .MAC  file  by
  8586.        regular users  can become  noticeably slower  (depending on how big it
  8587.        is) until  the .CMF  file can be properly written under a supervisor's
  8588.        access.   When the  .CMF file  is in sync with the .MAC file, dCOM can
  8589.        directly load  the .CMF file into memory without spending time loading
  8590.        the macro compiler overlay and then doing the actual compilation.
  8591.  
  8592.  
  8593.  
  8594.  
  8595.  
  8596.  
  8597.  
  8598.  
  8599.  
  8600.  
  8601.  
  8602.  
  8603.  
  8604.  
  8605.  
  8606.  
  8607.  
  8608.  
  8609.  
  8610.  
  8611.  
  8612.  
  8613.  
  8614.  
  8615.  
  8616.  
  8617.  
  8618.  
  8619.  
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  
  8629.  
  8630.  
  8631.                                           137
  8632.  
  8633.  
  8634.                                    Appendix B - Batch File Interchangeability
  8635.        ----------------------------------------------------------------------
  8636.  
  8637.  
  8638.  
  8639.  
  8640.  
  8641.                      Appendix B - Batch File InterchangeabilityAppendix B - Batch File Interchangeability
  8642.  
  8643.        Most batch  files can  be directly imported as macro files with little
  8644.        or no  modification.   dCOM's macro language is almost 100% compatible
  8645.        with the MS-DOS batch language.
  8646.  
  8647.        Batch file  commands that  are not  directly compatible with the macro
  8648.        language are:
  8649.  
  8650.        CALLCALL        This batch  command calls another batch file, allowing the
  8651.                    current batch  file to  resume when  the called batch file
  8652.                    terminates.   In the  macro language  you would delete the
  8653.                    "CALL" portion  of the  command and  just  say  the  batch
  8654.                    file's name as a macro command.  If a CALL command is left
  8655.                    in place,  it should  still function  properly to call the
  8656.                    specified batch file.
  8657.  
  8658.        FORFOR         This  batch  command  allows  a  DOS  command  to  execute
  8659.                    repeatedly for  every item produced in a data set.  In the
  8660.                    macro language  this capability  is emulated  by the DO or
  8661.                    DO WHILE commands,  which allow  multiple commands  inside
  8662.                    nestable DO  blocks.   If a  FOR batch  command is left in
  8663.                    place, dCOM will call a copy of COMMAND.COM to execute it,
  8664.                    usually with  the same  results.   Some conversion  effort
  8665.                    will be  required if  you want  to translate  a batch  FOR
  8666.                    command to a macro DO command.
  8667.  
  8668.        SHIFTSHIFT       This batch  command  shifts  the  command  line  variables
  8669.                    passed to  a batch  file in  %1...%9 down  a notch.   They
  8670.                    would roughly be equivalent to the macro's %P1 through %P9
  8671.                    variables, but  there is  no  macro  equivalent  for  this
  8672.                    command.
  8673.  
  8674.        IFIF          A batch  file IF  command requires  two consecutive equals
  8675.                    signs to  delimit the  operands being compared.  The macro
  8676.                    language only  requires one, but won't argue about finding
  8677.                    two of  them.   A batch file can't do greater than or less
  8678.                    than tests, just case-sensitive equality tests.  The macro
  8679.                    IF command  is not  case sensitive and does these tests as
  8680.                    well as compound, nestable IF block structures.
  8681.  
  8682.        Another syntax  difference is  that a  batch file  lets  you  start  a
  8683.        command with  an "@"  symbol in order to keep the batch command itself
  8684.        from echoing  on the  console when  the echo  mode is  on.   The macro
  8685.        language does  not have  an echo  mode  and  doesn't  echo  its  macro
  8686.        commands to  the screen,  so this  option is  meaningless.  It the "@"
  8687.        symbol is  encountered as  the first  significant character of a macro
  8688.        command, the "@" symbol is ignored but the command still executes.
  8689.  
  8690.  
  8691.  
  8692.                                           138
  8693.  
  8694.  
  8695.                                      Appendix C - The Internal Macro Compiler
  8696.        ----------------------------------------------------------------------
  8697.  
  8698.  
  8699.  
  8700.  
  8701.  
  8702.                       Appendix C - The Internal Macro CompilerAppendix C - The Internal Macro Compiler
  8703.  
  8704.        Understanding how  the internal macro compiler works can prove helpful
  8705.        from time  to time.  It has already been discussed somewhat in several
  8706.        other sections, like the one previous.
  8707.  
  8708.        The macro  compiler is  one of  many  overlays  that  are  all  merged
  8709.        together in the DCOM.OVL file.
  8710.  
  8711.        When dCOM  tries to load a macro file, either because it wants to load
  8712.        the default  macro file,  or because the user initiated an action like
  8713.        the file handler's "/" command, or because the current macro file used
  8714.        a GOSUBMF command (these are all just examples), dCOM looks for a file
  8715.        with a  .CMF (compiled macro file) extension that matches the filename
  8716.        of the .MAC file being loaded.   If it can find the .CMF and if it has
  8717.        the same  date stamp  as the  .MAC file,  the .CMF file will be loaded
  8718.        directly into memory and the operation is done with.  If it can't find
  8719.        the .CMF  file or  the date  stamps don't  match,  dCOM  automatically
  8720.        invokes the  macro compiler against the .MAC file.  After the compiler
  8721.        finishes building  the .MAC  file to a memory image, dCOM will attempt
  8722.        to save  it out  as a  .CMF file using the same date stamp of the .MAC
  8723.        file.
  8724.  
  8725.        ,---------------------------------------------------------------------,
  8726.         NOTE: When .CMF files are initially created, they are given a hidden       |                                                                     |
  8727.               attribute.   If you remove the hidden attribute on a .CMF file       |                                                                     |
  8728.               (the same  as with other hidden files), dCOM will respect that       |                                                                     |
  8729.               and continue  to leave  it unhidden when it has to rewrite the       |                                                                     |
  8730.               .CMF file again.       |                                                                     |
  8731.        `---------------------------------------------------------------------'
  8732.  
  8733.  
  8734.  
  8735.  
  8736.  
  8737.  
  8738.  
  8739.  
  8740.  
  8741.  
  8742.  
  8743.  
  8744.  
  8745.  
  8746.  
  8747.  
  8748.  
  8749.  
  8750.  
  8751.  
  8752.  
  8753.                                           139
  8754.  
  8755.  
  8756.                                                      Appendix D - ANSII Music
  8757.        ----------------------------------------------------------------------
  8758.  
  8759.  
  8760.  
  8761.  
  8762.  
  8763.                               Appendix D - ANSII MusicAppendix D - ANSII Music
  8764.  
  8765.        The macro  BEEP command  is capable of playing music in ANSI notation.
  8766.        This is  done by  following the beep command with the ANSI music text.
  8767.        If no  text follows  the BEEP  command, the  usual asynchronous system
  8768.        beep is sounded.  For those not familiar with ANSI music notation, the
  8769.        following is a brief description:
  8770.  
  8771.        A..GA..G        The musical  notes A  thru G.   A  note may be immediately
  8772.                    followed by  a modifier  ("#" or  "+" for  sharp, "-"  for
  8773.                    flat).   Next, a note may be followed by a number denoting
  8774.                    the note  length (1  for a  whole note  thru 64 for a 64th
  8775.                    note).   Lastly, a  note may  be followed  by one  or more
  8776.                    periods ("."),  each of  which will extend the note by one
  8777.                    half of its existing value.
  8778.  
  8779.        LnLn          Specifies the  default length of notes to follow ("n" is 1
  8780.                    for a  whole note  thru 64  for a 64th note).  The initial
  8781.                    default is 4 for a quarter note.
  8782.  
  8783.        OnOn          Specifies the  octave for  notes to  follow ("n"  may be 0
  8784.                    thru 7).  The initial default octave is 4, the same octave
  8785.                    in which middle C is found.
  8786.  
  8787.        P[n]P[n]        Specifies a  pause (no  sound).   The optional "n", may be
  8788.                    used to  give a  different note  length from  the  current
  8789.                    default (1 for a whole note thru 64 for a 64th note).  One
  8790.                    or more  periods (".")  may follow,  each  of  which  will
  8791.                    extend the pause by one half of its existing value.
  8792.  
  8793.        TnTn          Specifies the  tempo in  beats per  minute (32  thru 255).
  8794.                    The initial default is 120.
  8795.  
  8796.        For Example:
  8797.  
  8798.        ,---------------------------------------------------------------------,
  8799.         [F1] MUSIC?                            ;;TITLE LINE AND SWITCHES       |                                                                     |
  8800.              BEEP T240L3ABC#D                  ;;PLAY NOTES A, B, C#, AND D       |                                                                     |
  8801.        `---------------------------------------------------------------------'
  8802.  
  8803.  
  8804.  
  8805.  
  8806.  
  8807.  
  8808.  
  8809.  
  8810.  
  8811.  
  8812.  
  8813.  
  8814.                                           140
  8815.  
  8816.  
  8817.                                              Appendix E - Macro Error Numbers
  8818.        ----------------------------------------------------------------------
  8819.  
  8820.  
  8821.  
  8822.  
  8823.  
  8824.                           Appendix E - Macro Error NumbersAppendix E - Macro Error Numbers
  8825.  
  8826.        When a  macro error  occurs and  an  error  trap  has  been  set  with
  8827.        ONERRORGOTO, the  number of  the error  that occurred is available for
  8828.        testing in  %EL (the error text is also available in %ET).  Currently,
  8829.        this isn't  too awfully  useful because  a majority of the errors will
  8830.        return a  general DOS  file system I/O error (#35) that doesn't really
  8831.        help identify  what happened.   Nevertheless, the possible error codes
  8832.        are provided here for what they may be worth.
  8833.  
  8834.         1  INTERNAL MACRO ERROR            40  NOT LOGGED IN
  8835.         2  ERROR CHANGING DIRECTORY        41  ERROR MAPPING VOLUME PATH
  8836.         3  INVALID LEVEL                   42  ERROR ATTACHING TO SERVER
  8837.         4  LABEL NOT FOUND                 43  <Unassigned>
  8838.         5  COMSPEC NOT DEFINED             44  NETWORK DRIVERS NOT LOADED
  8839.         6  BAD COMMAND OR FILENAME         45  SERVER NOT SPECIFIED
  8840.         7  INSUFFICIENT MEMORY             46  ERROR READING CAPTURE FLAGS
  8841.         8  ERROR LOADING PROGRAM           47  ERROR WRITING CAPTURE FLAGS
  8842.         9  SYNTAX ERROR                    48  INVALID PRINT QUEUE
  8843.        10  ENVIRONMENT SPACE FULL          49  ERROR STARTING CAPTURE
  8844.        11  ERROR OPENING REDIRECTION       50  INVALID CAPTURE FILE
  8845.        12  NO FILES TAGGED
  8846.        13  LOOP WITHOUT TAG VARIABLE(S)
  8847.        14  TAG VARIABLE(S) WITHOUT LOOP
  8848.        15  COMMAND LINE OVERFLOW
  8849.        16  DO VARIABLE(S) WITHOUT DO
  8850.        17  NO MATCHING ENDIF
  8851.        18  NO MATCHING ENDDO
  8852.        19  ENDDO WITHOUT DO
  8853.        20  DO NEST LIMIT EXCEEDED
  8854.        21  GOSUB STACK OVERFLOW
  8855.        22  MACRO KEY MULTI-DEFINED
  8856.        23  LABEL MULTI-DEFINED
  8857.        24  FILE HANDLER VAR USED IN MENU
  8858.        25  INVALID DRIVE
  8859.        26  ERROR LOADING EDITOR OVERLAY
  8860.        27  FILE NOT FOUND
  8861.        28  SYNTAX ERROR IN FILE
  8862.        29  OUT OF WINDOWING MEMORY
  8863.        30  ERROR MAKING DIRECTORY
  8864.        31  VAR EXPANSION STACK OVERFLOW
  8865.        32  FILE NUMBER NOT OPEN
  8866.        33  LINE TOO LONG IN READ FILE
  8867.        34  READ PAST EOF
  8868.        35  DOS FILE SYSTEM I/O ERROR
  8869.        36  ILLEGAL VARIABLE NAME
  8870.        37  DISK SPACE FULL
  8871.        38  NO MATCHING IF..THEN
  8872.        39  INVALID SEARCH DRIVE
  8873.  
  8874.  
  8875.                                           141
  8876.  
  8877.  
  8878.  
  8879.  
  8880.  
  8881.  
  8882.  
  8883.  
  8884.                                        IndexIndex
  8885.        ======================================================================
  8886.  
  8887.        [DRIVEAUTO]  21                       EXITDCOM  43
  8888.        [EQUATES]  22, 124                    GET  44
  8889.        [FILEAUTO]  19                        GETW  45
  8890.        [MENUAUTO]  20, 122                   GOSUB  46
  8891.        [PUBLIC]  21, 124                     GOSUBMF  47
  8892.        Access Control                        GOTO  49
  8893.          Active Password  128                GOTOMF  49
  8894.          Administration  130                 IF  50, 51, 52
  8895.          Enabling  127                       INCLUDE  53
  8896.          Logging In  128                     KEYBOARD  54
  8897.          Logging Out  129                    KEYWAIT  54
  8898.          Overview  126                       LOOP  55
  8899.          With the Macro System  133          MACROMENU  55
  8900.        Arithmetic  28                        MD  56
  8901.          In-Line  33, 39, 50, 60, 74         MENU  56
  8902.        Array Variables  81                   MENUCOLOR  58
  8903.        AUTOEXEC.MAC  9, 13                   MENUSTART  59
  8904.        Batch File                            MENUTITLE  59
  8905.          Interchangeability  138             MKDIR  56
  8906.        Commands                              MUL  60
  8907.          ADD  33                             ONBREAKGOTO  60
  8908.          APPMENU  33                         ONERRORGOTO  61
  8909.          BEEP  34                            OPEN  62
  8910.          BROWSE  34                          PATH  63
  8911.          CD  35                              PATHADD  63
  8912.          CDD  35                             PATHDEL  64
  8913.          CDDO  35                            PAUSE  65
  8914.          CLOSE  35                           PRINTFIL  65
  8915.          CLS  36                             PRINTSTR  65
  8916.          COLOR  36                           PROMPT  66
  8917.          CREATE  37                          QFORMAT  66
  8918.          DEL  37                             RD  67
  8919.          DELAY  38                           READ  67
  8920.          DELAYW  38                          READB  67
  8921.          DIV  39                             READLN  68
  8922.          DO  39                              REBOOT  68
  8923.          DO WHILE  40                        RECOMPILE  69
  8924.          ECHO  41                            REM  69
  8925.          ECHOC  41                           RETURN  69
  8926.          ECHOR  42                           RMDIR  67
  8927.          EDIT  42                            RSTWIN  70
  8928.          ELSE  42                            RUNMACRO  70
  8929.          ELSEIF  42                          SELECT  70
  8930.          ENDDO  43                           SET  73
  8931.          ENDIF  43                           SHIP  73
  8932.          ERASE  37                           SUB  74
  8933.          EXIT  43                            VLIST  74
  8934.  
  8935.  
  8936.                                           142
  8937.  
  8938.  
  8939.                                                                         Index
  8940.        ----------------------------------------------------------------------
  8941.  
  8942.  
  8943.          WINDOW  74                          Menuing  120
  8944.          WRITE  76                         Macro Variables  78
  8945.          WRITEB  76                          Equates  22
  8946.        Comments  12, 24                      System Variables  82
  8947.        Compiling Macro Files  9              User Variables  80
  8948.        Ctrl-C Aborting  5                      Arrays  81
  8949.        Editing Macro Files  10                 Indirect Assignments  81
  8950.        Equate Variables  22                Menu Appearance  122
  8951.        Error Messages  6                   Menu Mode  120
  8952.        Escape Trapping  6                  Menu Title  12
  8953.        Examples  101                       Menuing
  8954.        Function Key Definitions              Controlling Menu Appearance
  8955.          Overview  16                            122
  8956.          Special  18                         Overview  120
  8957.            [DRIVEAUTO]  21                   The Menu Mode  121
  8958.            [EQUATES]  22, 124              Menuing Switches  30
  8959.            [FILEAUTO]  19                  Menus and Windows  29
  8960.            [MENUAUTO]  20, 122             Network
  8961.            [PUBLIC]  21, 124                 Use  69, 92, 100, 135
  8962.          Title Line Syntax  16             Password Protection  17
  8963.        Function Key Titles  16             Pause Messages  6
  8964.        IF Statements  26                   Redirection  24
  8965.          Compound  27                      System Variables  82
  8966.        In-Line                             Technical Tricks  116
  8967.          Arithmetic  28, 33, 39, 50, 60,   Title Line Switches  17
  8968.              74                              Password  17
  8969.        Include Files  123                    TSR Removal  17
  8970.        Indirect Assignments  81              Wait  17
  8971.        Introduction  2                     Title Line Syntax  16
  8972.        Leading Spaces  24                  Titles
  8973.        LOGIN.MAC  9, 14                      Function Key  16
  8974.        Macro Command Reference  32           Menu  12
  8975.        Macro Compiler  139                 TSR Removal  2, 17
  8976.        Macro Files                         User Variables  80
  8977.          AUTOEXEC.MAC  9, 13               Using Macro Keys
  8978.          Comments  12                        From the File Handler  7
  8979.          Compiling  9                        General Overview  5
  8980.          Editing  10                       Variable Types
  8981.          File Format  11                     Equates  22
  8982.          LOGIN.MAC  9, 14                    System  82
  8983.          Network Use  135                    User  80
  8984.          Overview  9                           Arrays  81
  8985.          Title Line Syntax  12                 Indirect Assignments  81
  8986.        Macro Key Definitions               Variables  78
  8987.          Password Protection  17             Reference
  8988.          Title Line Switches  17               %(###)  84
  8989.        Macro Language                          %[var]  84
  8990.          Command Reference  32                 %AT  85
  8991.          Examples  101                         %C1..%C3  85
  8992.          Overview  24                          %CC  86
  8993.          Technical Tricks  116                 %CD  86
  8994.        Macro System                            %CL  86
  8995.  
  8996.  
  8997.                                           143
  8998.  
  8999.  
  9000.                                                                         Index
  9001.        ----------------------------------------------------------------------
  9002.  
  9003.  
  9004.            %DD  86                             %XC  99
  9005.            %DE  87                             %XM  99
  9006.            %DF  86                         White Space  24
  9007.            %DN  87                         XM.SYS  99
  9008.            %DP  87
  9009.            %DS  87
  9010.            %DT  87
  9011.            %DV  88
  9012.            %DW  88
  9013.            %EL  88
  9014.            %ET  88
  9015.            %EX  89
  9016.            %FA  89
  9017.            %FC  90
  9018.            %FD  90
  9019.            %FE  90
  9020.            %FM  90
  9021.            %FN  90
  9022.            %FP  91
  9023.            %KB  91
  9024.            %LC  91
  9025.            %LD  92
  9026.            %LE  92
  9027.            %LN  92
  9028.            %MM  92
  9029.            %MY  92
  9030.            %OD  93
  9031.            %OS  93
  9032.            %P1..%P9  93
  9033.            %RJ  93
  9034.            %RT  94
  9035.            %SC  94
  9036.            %SE  95
  9037.            %SF  94
  9038.            %SL  94
  9039.            %SN  95
  9040.            %SP  95
  9041.            %SS  95
  9042.            %TC  96
  9043.            %TD  96
  9044.            %TE  96
  9045.            %TI  97
  9046.            %TL  97
  9047.            %TN  96
  9048.            %TR  97
  9049.            %UC  97
  9050.            %var%  84
  9051.            %VL  97
  9052.            %W  97
  9053.            %W1..%W4  98
  9054.            %WD  98
  9055.            %WT  98
  9056.  
  9057.  
  9058.                                           144
  9059.  
  9060.  
  9061.  
  9062.                                                                         Notes
  9063.        ----------------------------------------------------------------------